Created
June 14, 2010 19:01
-
-
Save ExperimentGarden/438114 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<title>Ajax JavaScript Loader</title> | |
<script type='text/javascript' src='jquery-1.3.2.min.js'></script> | |
<script type='text/javascript'> | |
//Sadly internalFunction can not be accessed here, only with the scope of the | |
//success function in which it was created using eval(); | |
function nonScope() | |
{ | |
internalFunction(); | |
} | |
$.ajax({type: "GET", | |
url: "1_loader.js", | |
success: function(responseText) | |
{ | |
function internalFunction() | |
{ | |
alert("Success."); | |
} | |
internalFunction(); //This function defined in the JavaScript code loaded. | |
nonScope(); | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
This is a basic test of loading JavaScript code via AJAX and then running it. | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment