Created
March 22, 2012 10:08
-
-
Save nesterchung/2157535 to your computer and use it in GitHub Desktop.
JavavScript : Load Js with call back
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//load external js | |
function loadJs(src, callback) { | |
s = document.createElement("script"); | |
s.src = "src"; | |
if (s.addEventListener) { | |
s.addEventListener("load", callback, false); | |
} else if (s.readyState) { | |
s.onreadystatechange = callback; | |
} | |
document.body.appendChild(s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment