jquery - Javascript runtime add js / css, how to get progress -


i want runtime add css , javascripts. want sure loaded before going further cannot find how can check dynamic loading progress of added file.

this loading script. there basic js function i'm missing or maybe jquery?

function loadfileruntime(filename){      "use strict";      var filetype;     var fileref;     var lastindex = filename.indexof("?");     if(lastindex===0) {         filetype = filename.substr(filename.lastindexof(".") + 1);     }else{         filetype = filename.substring( filename.lastindexof(".")+1, lastindex );     }       switch(filetype){          case "js":             fileref = document.createelement('script');             fileref.setattribute("type","text/javascript");             fileref.setattribute("src", filename);             break;          case "css":             fileref = document.createelement("link");             fileref.setattribute("rel", "stylesheet");             fileref.setattribute("type", "text/css");             fileref.setattribute("href", filename);             break;     }      if (typeof fileref !== "undefined"){         document.getelementsbytagname("head")[0].appendchild(fileref);     }  } 


Comments

Popular posts from this blog

java - Incorrect order of records in M-M relationship in hibernate -

command line - Use qwinsta in PowerShell ISE -

php - I want to create a website for polls/survey like this http://www.poll-maker.com/ -