X-Git-Url: http://git.asbjorn.biz/?p=jquery.git;a=blobdiff_plain;f=src%2Fajax.js;h=6cb2a626d848519ec6cc4f2ddd7dc456460d0edc;hp=33c3645098c8a569ddff97ba702fad65cec8bb3e;hb=97b32d78307273f8bd2e5147bf5c0f0a45607a95;hpb=85f0dda56289ed6c044dadb3a42b1a4d2ddb0891 diff --git a/src/ajax.js b/src/ajax.js index 33c3645..6cb2a62 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -121,9 +121,8 @@ jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".sp }; }); -jQuery.extend({ - - get: function( url, data, callback, type ) { +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { // shift arguments if data argument was omited if ( jQuery.isFunction( data ) ) { type = type || callback; @@ -132,13 +131,16 @@ jQuery.extend({ } return jQuery.ajax({ - type: "GET", + type: method, url: url, data: data, success: callback, dataType: type }); - }, + }; +}); + +jQuery.extend({ getScript: function( url, callback ) { return jQuery.get(url, null, callback, "script"); @@ -148,23 +150,6 @@ jQuery.extend({ return jQuery.get(url, data, callback, "json"); }, - post: function( url, data, callback, type ) { - // shift arguments if data argument was omited - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = {}; - } - - return jQuery.ajax({ - type: "POST", - url: url, - data: data, - success: callback, - dataType: type - }); - }, - ajaxSetup: function( settings ) { jQuery.extend( jQuery.ajaxSettings, settings ); },