diff --git a/src/ajax/jsonp.js b/src/ajax/jsonp.js index 0af00567..f4b324e1 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 d849cff2..773088fc 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(); } @@ -1128,6 +1128,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",