X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax.js;h=d4f2e12714b0634dab19be08f75e36b5db936fdf;hb=aee221d33c2db2c76639dabeca2b1e3d022e348e;hp=6821cecc4bdc7e60ca4cebf404d8b7657ffe1aab;hpb=4b8f6cdc86c395fb92c7d50e8642118963232af4;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index 6821cec..d4f2e12 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -52,10 +52,7 @@ jQuery.fn.extend({ // If not, just inject the full result res.responseText ); - // Add delay to account for Safari's delay in globalEval - setTimeout(function(){ - self.each( callback, [res.responseText, status, res] ); - }, 13); + self.each( callback, [res.responseText, status, res] ); } }); return this; @@ -200,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" ) {