};
});
-jQuery.extend({
-
- get: function( url, data, callback, type ) {
+jQuery.each( [ "GET", "POST" ], function( i, method ) {
+ jQuery[ method.toLowerCase() ] = function( url, data, callback, type ) {
// shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
type = type || callback;
}
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");
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 );
},