[jQuery] Issue with .ajax incrementally submitting.
Folks, I'm fiddling with jquery for the first time and have an issue:
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 preceeding code technically works but if I get an error from the
UpdateEntry servlet it throws the alert, however the next time I
trigger the same ajax call (without reloading the page) I get 2 error
alerts, then 3 then 4 ever incrementing. JS debugging seems to
indicate that the
// Handle the global AJAX counter
2058 if ( s.global && ! --jQuery.active )
2059 jQuery.event.trigger( "ajaxStop" );
jquery global counter is getting increased on each call so that it
essentially counts down with each error function call until the point
where ajaxStop is triggered.
I'm sure I'm missing something obvious. Any guidance would be
appreciated. Note I have not done any .ajaxSetup else where in the
page the above is the entirety of my .ajax call.
Cheers folks.
P.S. thanks for the great tool.