Jquery disable link for 5 seconds

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2011-01-04T06:07:50Z Indexed on 2011/01/04 6:53 UTC
Read the original article Hit count: 219

Filed under:
|
|
|
|

I have this code:

   $('#page-refresh').click( function() {
        $.ajax({
            url: "/page1.php",
            cache: false,
            dataType: "html",
            success: function(data) {
                $('#pagelist').html(data);
            }
        });
         return false;
   });

In this code is it possible that on the ajax success function it disables the #page-refresh click for 5 seconds then re-enable it? Basically if a person clicks the button and this action happens I dont want them to click and run this action again for another 5 seconds. I looked at delay() to unbind the click for this then bind it again but once it unbinded it never allowed me to click the button anymore.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX