Skip to content Skip to sidebar Skip to footer

Pause Before Jquery Ajax Post

Because the page I am working on is an intranet page, my AJAX call is very quick along with the response. For usability purposes I'd like a short 1-2 sec pause to display a loading

Solution 1:

I would have to suggesting thinking about a different way to add usability you are now slowing down your service to help users. What about using the Yellow Fade Technique That way you can show something has changed on the page and you are not slowing down your system.

Here is a related question that may help. Yellow fade Effect with JQuery

Solution 2:

Add a setTimeout call to the callback function:

functioncallback(data,status) {
  setTimeout(function() {
    $("#wait").hide();
    $("#ajaxdiv").html(data);
  }, 1500);
}

nb. the data parameter will be passed into the anonymous function as a closure, if I'm not mistaken

Solution 3:

Use setTimeout function

setTimeout("alert('5 seconds has passed.');",5000);

Post a Comment for "Pause Before Jquery Ajax Post"