diff options
author | jaubourg <j@ubourg.net> | 2011-01-12 18:36:00 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-01-12 18:36:00 +0100 |
commit | 0c51e9d55f39366cab14719b80cb7e989c716351 (patch) | |
tree | e602d1bcd82989b883443994eaa1970b9e86773c /src/ajax/jsonp.js | |
parent | f83cdc3c4c134b2796335e9f9806f3b67e7ca87f (diff) | |
download | jquery-0c51e9d55f39366cab14719b80cb7e989c716351.tar.gz jquery-0c51e9d55f39366cab14719b80cb7e989c716351.zip |
Fixes #4897. Added ?? as a context-insensitive placeholder for the callback name of a JSONP request. Unit tests provided.
Diffstat (limited to 'src/ajax/jsonp.js')
-rw-r--r-- | src/ajax/jsonp.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ajax/jsonp.js b/src/ajax/jsonp.js index f4b324e17..dd04b34b0 100644 --- a/src/ajax/jsonp.js +++ b/src/ajax/jsonp.js @@ -1,7 +1,7 @@ (function( jQuery ) { var jsc = jQuery.now(), - jsre = /\=(?:\?|%3F)(&|$)/i, + jsre = /(\=)(?:\?|%3F)(&|$)|()(?:\?\?|%3F%3F)()/i, rquery_jsonp = /\?/; // Default jsonp settings @@ -25,8 +25,8 @@ jQuery.ajax.prefilter("json jsonp", function(s, originalSettings) { var jsonpCallback = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, - url = s.url.replace(jsre, "=" + jsonpCallback + "$1"), - data = s.url === url && typeof(s.data) === "string" ? s.data.replace(jsre, "=" + jsonpCallback + "$1") : s.data; + url = s.url.replace(jsre, "$1" + jsonpCallback + "$2"), + data = s.url === url && typeof(s.data) === "string" ? s.data.replace(jsre, "$1" + jsonpCallback + "$2") : s.data; if ( url === s.url && data === s.data ) { url += (rquery_jsonp.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; |