Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7186 closed bug (worksforme)

Possible incorrect dataType is set in .get()

Reported by: opentitan@… Owned by:
Priority: undecided Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

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
		});
	},

NOTE:

            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 9 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.