javascript - Is there another way to disable cache when fetching script? -


i use fetch script;

$.getscript("http://www.example.org/"); 

however, dont want cached. means if use getscript again, script should fetch again.

this 1 works in theory;

$.getscript("http://www.example.org/?" + math.random()); 

but in practically, it's not. because "?" disabled on remote site url, question is, there otherway tell browser not cache ?

recreate function needs:

(function () {     $.getscript = function(url, callback) {         $.ajax({                 type: "get",                 url: url,                 success: callback,                 datatype: "script",                 cache: false         });     }; })(); 

now won't cache anymore when call function like

$.getscript('script.js', function() {     // non cached script.js }); 

Comments

Popular posts from this blog

swift - Button on Table View Cell connected to local function -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

c# - ajax - How to receive data both html and json from server? -