Skip to content

Instantly share code, notes, and snippets.

@inter-coder
Last active August 29, 2015 14:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save inter-coder/ee717b47732104590cb2 to your computer and use it in GitHub Desktop.
Load javascript without caching using ajax request
function loadJS(file,CallBack){
var xmlhttp=new XMLHttpRequest();
var ts = "?"+new Date().getTime();// use timestamp for prevent caching
xmlhttp.open('GET', file+ts,true);
xmlhttp.onload=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){CallBack(xmlhttp.responseText);};
};
xmlhttp.send();
};
loadJS("//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.7.0/bootstrap-table.min.js",function(response){
console.log(response,'loaded');
eval(response);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment