javascript - AjaxComplete called to often -
i have code:
$( document ).ajaxcomplete(function( event, xhr, settings ) { console.log('test'); });
i opened chrome network tab , can see 1 entry (status 200).
but console displays:
(28) test
why executed often?
the ajaxcomplete
triggers when ajax
request completed, if it's successfull or not.
200 status code
means request has gone right, but, can read in jquery docs callback fire every time ajax
request has finished.
so, check url request redirecting , handle ones need.
anyway ( side note ) use built-in ajax
callback function complete
, this:
$.ajax({ url: url, data: { data }, complete:function(){ console.log('test'); } });
Comments
Post a Comment