Saturday, November 17, 2012

jquery – how to run javascript while waiting for the ajax callback

I am making an ajax call to the server. The code I need to run can be divided into 3 groups.



  1. Code that needs to run before the ajax call ins made (preparing the json object going to the server)

  2. Code that needs to be run after the ajax call has returned (uses what was sent back from the server)

  3. Code that needs to be run between the time the user presses a button and the time everything is done. This code does not need the returned json object.


It would be ideal to run the code in group 3 after making the ajax call and before the results are back to gain the best user experience and performance.


Can this be done?


How?






Rating: 4 out of 5 based on 3 ratings



The post jquery – how to run javascript while waiting for the ajax callback appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/jquery-how-to-run-javascript-while-waiting-for-the-ajax-callback.html

No comments:

Post a Comment