I am using $.getScript()
to get a script from somewhere.
function fetch(url){
window.setInterval(function (){
$.getScript(url);
},50000)
}
fetch("http://example.com/script.js");
However, when I look at the FireBug developer console, I have seen that it adds additional ?numbers. Here is the output:
<script async="" src="http://example.com/script.js?7330519448833367000&_=1416681336440">
The remote server has disabled the ? char from their htaccess. I need to use $.getScript("")
to get the remote script, but how is it possible to prevent the function that adding additional ?numbers ?
It's because jQuery sets caching to
false
(by default) when you use$.getScript()
.From the jQuery documentation:
To disable caching, add the following before the
$.getScript
call: