Ticket #4384: get_post_shift_args.patch
File get_post_shift_args.patch, 1.4 KB (added by , 13 years ago) |
---|
-
jquery/test/unit/ajax.js
424 424 }); 425 425 }); 426 426 427 test("jQuery.get/post - type arg is shifted if data is ommitted", function() { 428 expect(2); 429 var funcs = [jQuery.get, jQuery.post]; 430 jQuery.each(funcs, function () { 431 stop(); 432 this(url('data/json.php'), function(json) { 433 equals( typeof json, 'object', 'Check that type="json" was honored'); 434 start(); 435 }, 'json'); 436 }); 437 }); 438 427 439 test("jQuery.getScript(String, Function) - with callback", function() { 428 440 expect(2); 429 441 stop(); -
jquery/src/ajax.js
97 97 jQuery.extend({ 98 98 99 99 get: function( url, data, callback, type ) { 100 // shift arguments if data argument was om mited100 // shift arguments if data argument was omitted 101 101 if ( jQuery.isFunction( data ) ) { 102 callback = data; 103 data = null; 102 return jQuery.get( url, null, data, callback ); 104 103 } 105 104 106 105 return jQuery.ajax({ … … 121 120 }, 122 121 123 122 post: function( url, data, callback, type ) { 123 // shift arguments if data argument was omitted 124 124 if ( jQuery.isFunction( data ) ) { 125 callback = data; 126 data = {}; 125 return jQuery.post( url, {}, data, callback ); 127 126 } 128 127 129 128 return jQuery.ajax({