Skip to main content

Bug Tracker

Side navigation

#7186 closed bug (worksforme)

Opened October 14, 2010 08:36AM UTC

Closed October 14, 2010 12:53PM UTC

Possible incorrect dataType is set in .get()

Reported by: opentitan@gmail.com 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!

Attachments (0)
Change History (1)

Changed October 14, 2010 12:53PM UTC by dmethvin comment:1

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