I encountered an unusual problem. I have a ajax setup. And clicking a
specified image will call this ajax function.
It goes something like:

jQuery.ajaxSetup({
   'beforeSend': function(xhr) {xhr.setRequestHeader("Accept","text/
javascript")}
})

jQuery.fn.checkmarkClickWithAjax = function(){
   this.click(function(){
       $(this).html("<img src='/images/icons/wait.gif' />");
       $.ajax({
           url: this.href,
           dataType: "script"
       });
       return false;
   });
   return this;
};

$(function(){
    $(".checkmark").checkmarkClickWithAjax();
});

The issue I am having is only alternate clicking of "checkmark" will
call up the click function. For example, The first time I click, I get
a response from the click function within checkmarkClickWithAjax. Then
the next click, it does not. And the next click it does. So what was
happening was first click it calls the href url via ajax, and then
next click it doesn't but went straight to href url the regular way.

I can't figure out why, even after going through the code over and
over again.

Thanks in advance for the help.

Reply via email to