]> source.dussan.org Git - jquery.git/commitdiff
Fixes #5812. =? will be detected even when it has been escaped during data serialization.
authorjaubourg <j@ubourg.net>
Sun, 9 Jan 2011 20:48:52 +0000 (21:48 +0100)
committerjaubourg <j@ubourg.net>
Sun, 9 Jan 2011 20:48:52 +0000 (21:48 +0100)
src/ajax/jsonp.js
test/unit/ajax.js

index 0af00567c3e37bec7b92beab6acc6d5e82787ff4..f4b324e17c2155308e0b880598035b99f55be9eb 100644 (file)
@@ -1,7 +1,7 @@
 (function( jQuery ) {
 
 var jsc = jQuery.now(),
-       jsre = /\=\?(&|$)/,
+       jsre = /\=(?:\?|%3F)(&|$)/i,
        rquery_jsonp = /\?/;
 
 // Default jsonp settings
index d849cff246b8669e7ac610f9c4dfe902a9c1bef5..773088fc98c47b1c97d07d94902b2e16ff136554 100644 (file)
@@ -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",