1$.put = function(url, data, callback, type){
2
3 if ( $.isFunction(data) ){
4 type = type || callback,
5 callback = data,
6 data = {}
7 }
8
9 return $.ajax({
10 url: url,
11 type: 'PUT',
12 success: callback,
13 data: data,
14 contentType: type
15 });
16}
17
1jQuery.each( [ "put", "delete" ], function( i, method ) {
2 jQuery[ method ] = function( url, data, callback, type ) {
3 if ( jQuery.isFunction( data ) ) {
4 type = type || callback;
5 callback = data;
6 data = undefined;
7 }
8
9 return jQuery.ajax({
10 url: url,
11 type: method,
12 dataType: type,
13 data: data,
14 success: callback
15 });
16 };
17});
18