Reputation: 31
What I'm trying to do is load an external html file and have the Javascript that is embedded execute along with the html code that I had in my Loading_Page.html
.
The code I'm trying to use is this:
$("#myBtn").click(function() {
$("#myDiv").load("Loading_Page.html");
});
Loading_Page.html looks like this (simple now, but will expand once/if I get this working).It has both html and javascript, so I need to get Html page along with the javascript.
<html>
<head>
<title>Tracking HTML File</title>
<script language="javascript" type="text/javascript">
alert("outside the jQuery ready");
</script>
</head>
<body>
<div id="first_division"><img src="someimage.jpg" alt="image" /></div>
<div id="second_division"><p>some text</p></div>
</body>
</html>
But the javascript in Loading_Page.html page is not executing along with the html code in Loading_Page Any thoughts on why the browser is ignoring the Javascript in the Loading_Page.html file?
Thanks for your help in advance!
Upvotes: 3
Views: 4209