I tried to load HTML page with scripts using .load function. But, its not working.
Is there any way to change existing code as AJAX to load complete html page with scripts? We need this script to trigger while changing the contents based on the list item selected.
Thanks HTML
<ul class="choices--sp">
<li><a href="javascript:;" data-url="global.html">GLOBAL</a></li>
<li><a href="javascript:;" data-url="australia.html">Australia</a></li>
</ul>
<div id="container">
</div>
JS
$('.choices--sp li a').click(function(){
$('#container').load($(this).attr('data-url') + ' #ajax--container');
return false;
});
HTML page to load inside AJAX
<div id="ajax--container">
<section class="component">
<div class="page">
Test
<script type="text/javascript">
$(document).ready(function () {
alert(1);
});
</script>
<div>
</section>
</div>