How to open the JQuery JDialog window if response take more than 5 seconds.
Below is my code
$("#Dialog").dialog(
{
autoOpen: false,
modal: true,
height: 175,
position: 'center',
bgiframe: true,
display: 'visible',
width: 400
});
I want to show the above dialog if response time (AJAX) takes more than 5 seconds and auto close once i get the response (AJAX).
Any help would be helpful.
Thanks
You can use setTimeout() to start a timer that will open your dialog after 5 seconds. This method returns a reference to the timer that it creates. Do that in the “beforeSend” callback, which is executed before the request starts.
In the complete callback (or the success + error callback), clear the timer with clearTimeout() and close the dialog.