Fixed #1750 by adding a url that starts with "//" and is a dataType "script" will...
[jquery.git] / src / ajax.js
index d4f2e12..35995f6 100644 (file)
@@ -200,7 +200,7 @@ jQuery.extend({
                if ( s.cache === false && s.type.toLowerCase() == "get" ) {
                        var ts = (new Date()).getTime();
                        // try replacing _= if it is there
-                       var ret = s.url.replace(/(\?|&)_=.*(&|$)/, "$1_=" + ts + "$2");
+                       var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
                        // if nothing was replaced, add timestamp to the end
                        s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
                }
@@ -218,8 +218,8 @@ jQuery.extend({
                        jQuery.event.trigger( "ajaxStart" );
 
                // If we're requesting a remote document
-               // and trying to load JSON or Script
-               if ( !s.url.indexOf("http") && ( s.dataType == "script" || s.dataType =="json" ) ) {
+               // and trying to load JSON or Script with a GET
+               if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) {
                        var head = document.getElementsByTagName("head")[0];
                        var script = document.createElement("script");
                        script.src = s.url;