Ok, self[...] was BS, switching to window[...], bug #1748.
[jquery.git] / src / ajax.js
index f401c85..09aba14 100644 (file)
@@ -174,12 +174,12 @@ jQuery.extend({
                }
 
                // 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++;
 
                        // Replace the =? sequence both in the query string and the 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);
 
                        // We need to make sure
@@ -223,7 +223,7 @@ jQuery.extend({
                        script.src = s.url;
 
                        // Handle Script loading
-                       if ( !jsonp && (s.success || s.complete) ) {
+                       if ( !jsonp ) {
                                var done = false;
 
                                // Attach handlers for all browsers