Last active
February 3, 2016 09:52
-
-
Save cedeber/3f63e0d258e3a2e6364b to your computer and use it in GitHub Desktop.
Avoid AJAX request cache with a dummy parameter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uncache( url ) { | |
var uncached = Math.round( Math.random() * 10000 ) + Date.now(); | |
uncached = ( /\?/.test( url ) ? "&" : "?" ) + "_=" + uncached; | |
return url + uncached; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment