Skip to main content

Bug Tracker

Side navigation

Ticket #2020: 2020.diff
File 2020.diff, 1.0 KB (added by davidserduke, December 17, 2007 12:01AM UTC)

patch

Index: src/ajax.js
===================================================================
--- src/ajax.js	(revision 4175)
+++ src/ajax.js	(working copy)
@@ -151,7 +151,7 @@
 	lastModified: {},
 
 	ajax: function( s ) {
-		var jsonp, jsre = /=(\?|%3F)/g, status, data;
+		var jsonp, jsre = /=(\?|%3F)(&|$)/g, status, data;
 
 		// Extend the settings, but re-extend 's' so that it can be
 		// checked again later (in the test suite, specifically)
@@ -177,8 +177,8 @@
 
 			// Replace the =? sequence both in the query string and the data
 			if ( s.data )
-				s.data = (s.data + "").replace(jsre, "=" + jsonp);
-			s.url = s.url.replace(jsre, "=" + jsonp);
+				s.data = (s.data + "").replace(jsre, "=" + jsonp + "$2");
+			s.url = s.url.replace(jsre, "=" + jsonp + "$2");
 
 			// We need to make sure
 			// that a JSONP style response is executed properly
@@ -192,6 +192,8 @@
 				// Garbage collect
 				window[ jsonp ] = undefined;
 				try{ delete window[ jsonp ]; } catch(e){}
+				if (head)
+					head.removeChild( script );
 			};
 		}

Download in other formats:

Original Format