diff options
author | jaubourg <j@ubourg.net> | 2011-01-09 21:48:52 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-01-09 21:48:52 +0100 |
commit | 8c8bd3bf6ac982f98c1b89b0af74a1fd2d07e360 (patch) | |
tree | c9a8395d5e7145cfd4a496c397d2d137c76dcaaa | |
parent | 62a1a1a8fa64f92f429a3f5b8ed2e0d1f6fc3d6c (diff) | |
download | jquery-8c8bd3bf6ac982f98c1b89b0af74a1fd2d07e360.tar.gz jquery-8c8bd3bf6ac982f98c1b89b0af74a1fd2d07e360.zip |
Fixes #5812. =? will be detected even when it has been escaped during data serialization.
-rw-r--r-- | src/ajax/jsonp.js | 2 | ||||
-rw-r--r-- | test/unit/ajax.js | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/ajax/jsonp.js b/src/ajax/jsonp.js index 0af00567c..f4b324e17 100644 --- a/src/ajax/jsonp.js +++ b/src/ajax/jsonp.js @@ -1,7 +1,7 @@ (function( jQuery ) { var jsc = jQuery.now(), - jsre = /\=\?(&|$)/, + jsre = /\=(?:\?|%3F)(&|$)/i, rquery_jsonp = /\?/; // Default jsonp settings diff --git a/test/unit/ajax.js b/test/unit/ajax.js index d849cff24..773088fc9 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -1081,7 +1081,7 @@ test("jQuery.getScript(String, Function) - no callback", function() { }); test("jQuery.ajax() - JSONP, Local", function() { - expect(9); + expect(10); var count = 0; function plus(){ if ( ++count == 9 ) start(); } @@ -1131,6 +1131,22 @@ test("jQuery.ajax() - JSONP, Local", function() { jQuery.ajax({ url: "data/jsonp.php", dataType: "jsonp", + data: { + callback: "?" + }, + success: function(data){ + ok( data.data, "JSON results returned (GET, processed data callback)" ); + plus(); + }, + error: function(data){ + ok( false, "Ajax error JSON (GET, processed data callback)" ); + plus(); + } + }); + + jQuery.ajax({ + url: "data/jsonp.php", + dataType: "jsonp", jsonp: "callback", success: function(data){ ok( data.data, "JSON results returned (GET, data obj callback)" ); |