Hi Will, This should do it:
var callajax = function(){ $.ajax({ url: 'foo.html', // replace this with your url success: function(data) { console.log('yay!'); }, error: bindclick }); }; var bindclick = function() { $("a").one("click", callajax); }; bindclick(); --Karl ____________ Karl Swedberg www.englishrules.com www.learningjquery.com On Jun 4, 2009, at 7:29 PM, Will Olbrys wrote:
I'd like to make my buttons clickable once so I use the .one() method to set up their binding. This way users don't click a form's button more than once while it is submitting. I thought this would be easy to do but I cant seem to rebind the button during the error event. I was hoping I could just call .one() again but it does not seem to work in all browsers. simplified example below... $("#mybutton").one("click",null,callajax); var callajax = function(e){ $.ajax({ success: function(data){console.log("yay!");}, error: function(){//REBIND THE BUTTON} }) } any thoughts on best acheiving this as simply as possible? Thanks, will olbrys willolbrys.com