I'm posting a form to an MVC action using jquery Ajax. Server side, I call a send mail async function. While debugging, I can see execution continue all the way through the return statement from the action. Even though th开发者_如何学Goe return statement is reached, the ajax success callback doesn't get called until the async mail function finishes. I observe in Firebug that the POST is still waiting on a response. Why does the response get blocked until the async call finishes? Any way to fix it?
I've tested with both the Visual Studio development web server and localhost IIS 7.5 (windows 7). I have not tested on a windows server box.
I've scoured the web and stack overflow and have not found an answer. The closest thing I found mentioned visual studio web server not being as "threaded" as local IIS, but since I've tested on both, it has to be something else.
Thanks! Philip
that is because the response of your ajax post wait until your ajax call of send mail is finished so you may make calling send mail in another thread or call it using jquery if possible
精彩评论