use $.ajaxStart and $.ajaxStop for showing/hiding your loader

----- Original Message ----- From: "brian" <bally.z...@gmail.com>
To: <jquery-en@googlegroups.com>
Sent: Sunday, August 16, 2009 12:17 PM
Subject: [jQuery] Re: how do I hide an element after my function completes



Use the 3rd param of $.get()

$(function() {
  $(".pagination a").live("click", function() {
      var loader = $('#loader')
      loader.show()   // <-- hidden loader div
      $.get(
this.href,
null,
function()
{
loader.hide();
},
"script"
);
      return false;
  })
});

Incidentally, I recently came across this handy plugin:

http://plugins.jquery.com/project/loading


On Sun, Aug 16, 2009 at 1:11 PM, Rich Sturim<cosmos99...@gmail.com> wrote:

I have a hidden spinner div.

When my jquery function is called -- I show the spinner. But, how do
hide I the spinner div after the ajax request has completed?


$(function() {
$(".pagination a").live("click", function() {
var loader = $('#loader')
loader.show() // <-- hidden loader div
$.get(this.href, null, null, "script");
return false;
})
});

Reply via email to