In traditional javascript AJAX, we know if readystate
is:
- 0 - The request is not initialized
- 1- The request has been set up
- 2 - The request has been sent
- 3 - The request is in process
- 4 - The request is complete.
When it comes to jQuery AJAX, we have:
complete
property where we code what should happen after completionsuccess
property where we code what should happen if the ajax request succeeds anderror
property where we code what should happen if ajax request fails.
All of the above properties lets us code to do something after completion of ajax request. Where can I specify some code to execute something during processing(when readyState is 3) in Jquery Ajax??
As my AJAX script takes too long time to execute, which means, I will not attain 'complete' stage quickly. This seems like nothing is happening to the user. I wanted to initiate another ajax script at processing stage which gets information from server meanwhile and shows the user what has been done so far. Is it possible at all in Javascript? I know there is no multi-threading in Javascript.
I think I made my self clear. But, Please let me know if anything is not making any sense.