Bug Tracker

Ticket #265 (closed bug: fixed)

Opened 2 years ago

Last modified 1 year ago

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

Reported by: Jan Assigned to: anonymous
Type: bug Priority: major
Milestone: Component: ajax
Version: Keywords:
Cc: Needs:

Description

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" );

Attachments

Change History

Changed 2 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.

Changed 2 years ago by joern

  • status changed from new to closed
  • resolution set to fixed

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.