Bug Tracker

Opened 12 years ago

Closed 12 years ago

#7186 closed bug (worksforme)

Possible incorrect dataType is set in .get()

Reported by: [email protected] Owned by:
Priority: undecided Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:


Looking at this section of code:

	get: function( url, data, callback, type ) {
		// shift arguments if data argument was omited
		if ( jQuery.isFunction( data ) ) {
			type = type || callback;
			callback = data;
			data = null;

		return jQuery.ajax({
			type: "GET",
			url: url,
			data: data,
			success: callback,
			dataType: type


            type = type || callback;

Should this be: type = type || type = callback; or just type = callback;?

Do I miss something?

Thanks for great work!

Change History (1)

comment:1 Changed 12 years ago by dmethvin

Resolution: worksforme
Status: newclosed

It's playing safe with the parameter hockey there, in case someone passed null in the callback arg rather than leaving it out. So these are all equivalent:

  .get(myurl, null, myfunc, "JSON")
  .get(myurl, myfunc, null, "JSON")
  .get(myurl, myfunc, "JSON")
Note: See TracTickets for help on using tickets.