X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax.js;h=104961497c96b4eeb553a425d70cc669b1ca7d57;hb=ffbedf0262b3eea906f39c0115b818d7456a3994;hp=ba3aa968df71bdc3f8eb1c7d0eb94079ce94c93c;hpb=aca1cc367782f8d038a13794a46aec6fd825eb45;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index ba3aa96..1049614 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -197,8 +197,13 @@ jQuery.extend({ if ( s.dataType == "script" && s.cache == null ) s.cache = false; - if ( s.cache === false && s.type.toLowerCase() == "get" ) - s.url += (s.url.match(/\?/) ? "&" : "?") + "_=" + (new Date()).getTime(); + 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"); + // if nothing was replaced, add timestamp to the end + s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); + } // If data is available, append data to url for get requests if ( s.data && s.type.toLowerCase() == "get" ) {