Opened 10 years ago
Closed 10 years ago
#14053 closed bug (notabug)
ajaxStart Event is ignored for the first time when ajax function is called from JQuery
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The ajaxStart Event is ignored for the first time when ajax function is called from JQuery.
Below is the sample code which ran with JQuery 1.8.3
$.ajax({
type : 'get', url : 'tasks.json', dataType : 'json', });
$(this).ajaxStart(function(){
console.log("ajaxStart");
}); $(this).ajaxStop(function(){
console.log("ajaxStop");
});
when you run this code... for the first time the ajaxStart event will be ignored and direct ajaxStop event will be called.. but for all other successive call's the ajaxStart event is also getting triggered... Basic Investigation based of JQuery 1.8.3 version :
below code inside trigger function is avoiding ajaxStart event to get executed and this is because for the first time when we trigger ajaxStart event its not present under jQuery.event.global Array list..
jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { |
No jQuery handlers for this event type, and it can't have inline handlers
return; }
Change History (2)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
See the jQuery 1.9 upgrade guide. The event is only fired on document
. Also use the jQuery Migrate plugin.
The issue is more or less same as Ticket #11038 - PROBLEM WITH AJAXSTART IN 1.7.1.. which is closed without resolution
Thanks, Hrishi