-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move function load_script to separate file
- Loading branch information
1 parent
8e13701
commit 1259d84
Showing
2 changed files
with
17 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//from http://stackoverflow.com/questions/950087/how-to-include-a-javascript-file-in-another-javascript-file | ||
var loadScript = function(url, callback) { | ||
// Adding the script tag to the head as suggested before | ||
var head = document.getElementsByTagName('head')[0]; | ||
var script = document.createElement('script'); | ||
script.type = 'text/javascript'; | ||
script.src = url; | ||
|
||
// Then bind the event to the callback function. | ||
// There are several events for cross browser compatibility. | ||
script.onreadystatechange = callback; | ||
script.onload = callback; | ||
|
||
// Fire the loading | ||
head.appendChild(script); | ||
}; |
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