Reputation: 1
I have an html file:index.html which contains some basic js libs. And I also have some modules:
a.html:
<div id='a'>
<script src="a1.js"></script>
<script src="a2.js"></script>
</div>
a1.js:
console.log('a1')
a2.js:
console.log('a2')
How can I dynamically load a.html into index.html and get the event that a1.js and a2.js are completed executed?
Upvotes: 0
Views: 934
Reputation: 1596
use w3data.js
to do that ( w3data.js )
Example: in index.html
<html>
<script src="http://www.w3schools.com/lib/w3data.js"></script>
<body>
<div w3-include-html="a.html"></div>
<script>
w3IncludeHTML();
</script>
</body>
</html>
Upvotes: 1