[jQuery] Rebinding .one() on ajax callback
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