Folks,
I'm missing something here but can't figure it.
The following is inside a $('#xx').click event handler that inside a
div that is originally hidden until a parent is clicked. The the
revealed #xx button is clicked firing this:
var dnsData="smode=clearnode&hn="+hn+"&oldip="+ip+"&entry="+entry;
$.ajax({
url:
"UpdateEntry",
type: "POST",
dataType:
"html",
data:
dnsData,
success:
function(msg){
alert("DNS Update Succeeded");
},
error:
function(msg){
alert("Critical Error in DNS Update. No changes applied.
Please manually check UDNS for \n"+hn+" set to 1.1.1.1");
}
});
The POST itself is working, but each time this event set is fired the
POST itself get's executed only once but either success or error local
function gets executed x times. i.e. first time I fire this event (in
an error condition) error gets called once, but if I click again it
get's fired twice, again and three times etc etc.
Or if I click away from the #xx button (which rehides it's parent div)
then reveal it again the same thing happens.
Debugging via Firebug seems to show that
// Handle the global AJAX counter
2058 if ( s.global && ! --jQuery.active )
2059 jQuery.event.trigger( "ajaxStop" );
jQuery.active is incrementing on each execution of the #xx button,
which then in turn decreases on each call to - for example the error
function - until finally ajaxStop is called.
I've tried setting global: false in the ajax above but to no avail.
also I have a .post in the same page that seems to show the same
behaviour.
I'm have no idea what is causing this, any help would be greatly
appreciated.
Cheers