javascript - Ideas how to get a div to appear if AJAX request takes longer then x-ms? -
I have an AJAX call that I need to implement in every two seconds, usually around 25 mms in call But from time to time (maybe 10%) the call can be taken between 300 mms and 9 00 mms, what I wanted to do, if and then say ... 250 mms ended, one To be shown as "loading" for the original, for Div, which will disappear on the success of AXX Weri. Is it possible to do this? If so, how would such a complex be?
If this helps, then this is my current AJAX call:
$ .ajax ({type: "post", data type: "jason", url : ".. /PHP/mapParse.php", data: {account: sessionStorage.account, direction: DIRE}, success: generatemap,});
Thanks advance!
Use window.setTimeout to set an expiry time after the desired delay. $ AJAX line Set the timeout before, and save the timeout id in the local variable. In the timeout handler, display your divisor.
When the AJAX call is complete, cancel the timeout, hide the device or both. You can cancel a timeout with the window. Pure timeline, timeout id saved before pass.
Comments
Post a Comment