Bug Tracker

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#265 closed bug (fixed)

Some variables are not initialized properly in jQuery.ajax in 1.0.2

Reported by: Jan Owned by:
Priority: major Milestone:
Component: ajax Version:
Keywords: Cc:
Blocked by: Blocking:


The variables success, error, dataType, global and timeout are only initialized properly if theres only one argument passed to jQuery.ajax as object.

if ( !url ) {
	ret = type.complete;
	var success = type.success;
	var error = type.error;
	var dataType = type.dataType;
	var global = typeof type.global == "boolean" ? type.global : true;
	var timeout = typeof type.timeout == "number" ? type.timeout : jQuery.timeout;
	var ifModified = type.ifModified || false;
	data = type.data;
	url = type.url;
	type = type.type;

Otherwise, for example global is undefined and no ajax events are triggered

if ( global && ! jQuery.active++ )
	jQuery.event.trigger( "ajaxStart" );

Change History (2)

comment:1 Changed 16 years ago by joern

Good catch. This prevents to global handlers to work when $.ajax is not called directly.

Another good reason to synchronize both internal and external $.ajax API.

comment:2 Changed 16 years ago by joern

Resolution: fixed
Status: newclosed

global and timeout options are now initialized properly when $.ajax is called internally (argument list instead of hash). Fix in SVN.

Note: See TracTickets for help on using tickets.