| 200 | | if ( s.cache === false && s.type.toLowerCase() == "get" ) |
| 201 | | s.url += (s.url.match(/\?/) ? "&" : "?") + "_=" + (new Date()).getTime(); |
| | 200 | if ( s.cache === false && s.type.toLowerCase() == "get" ) { |
| | 201 | var now = (new Date()).getTime(); |
| | 202 | if (s.url.match(/\?/)) { |
| | 203 | // Query string exists, check for cache key |
| | 204 | if (s.url.match(/_=/)) { |
| | 205 | // Cache key exists, replace the value |
| | 206 | var parts = s.url.split("?"); |
| | 207 | var params = parts[1].split("&"); |
| | 208 | var newParams = []; |
| | 209 | |
| | 210 | s.url = parts[0] + "?"; // Building the new url |
| | 211 | $(params).each(function (i) { |
| | 212 | if (this.match(/_=/)) { |
| | 213 | newParams[i] = "_=" + now; // Insert new value |
| | 214 | } else { |
| | 215 | newParams[i] = this; // Reuse existing value |
| | 216 | } |
| | 217 | }); |
| | 218 | s.url += newParams.join("&"); |
| | 219 | } else { |
| | 220 | // cache key does not exist, add it |
| | 221 | s.url += "&_=" + now; |
| | 222 | } |
| | 223 | } else { |
| | 224 | // query string does not exist, add cache key |
| | 225 | s.url += "?_=" + now; |
| | 226 | } |
| | 227 | } |