Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js load js file

function loadScript( url, callback ) {
  var script = document.createElement( "script" )
  	  script.type = "text/javascript";
      script.src = url;
 	  script.onload = function() {
     	callback()
      };
     document.head.appendChild(script); 
}
// call the function...
loadScript("js/myscript.js", function() {
  alert('script ready!'); 
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #load #js #file
ADD COMMENT
Topic
Name
8+8 =