0

At the moment I have a HTML where files can be dynamically loaded.

I am using the load() function. Within the loaded HTML file, there is an external script that I would like to execute, but it won't execute? The script will execute if I go to the HTML document directy, but not when I am using the load function.

Here is my code:

Index Page

$(".pages").load("page1.html");

page1.html

<script type="text/javascript" src="alert.js"></script>
<h1>Welcome to page one</h1>

Alert.js

alert("This page has loaded");

I can confirm the rest of page1.html appears, just the javascript file won't

Help will be appreciated guys!

Thanks Peter

4

0 回答 0