Commit 80a26a32 authored by John Resig's avatar John Resig

Fix for bug #1638, where a non-string data could break an Ajax request.

parent 14b88f60
...@@ -174,12 +174,12 @@ jQuery.extend({ ...@@ -174,12 +174,12 @@ jQuery.extend({
} }
// Build temporary JSONP function // Build temporary JSONP function
if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { if ( s.dataType == "json" && (s.data && jsre.test( s.data ) || s.url.match(jsre)) ) {
jsonp = "jsonp" + jsc++; jsonp = "jsonp" + jsc++;
// Replace the =? sequence both in the query string and the data // Replace the =? sequence both in the query string and the data
if ( s.data ) if ( s.data )
s.data = s.data.replace(jsre, "=" + jsonp); s.data = (s.data + "").replace(jsre, "=" + jsonp);
s.url = s.url.replace(jsre, "=" + jsonp); s.url = s.url.replace(jsre, "=" + jsonp);
// We need to make sure // We need to make sure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment