i'm trying to load .aspx
page using jquery like this;
$('ul#menu li ul.collapse').on('click', 'li a', function (e) {
e.preventDefault();
var div = $('#content .container-fluid .row-fluid .span12');
var url = $(this).attr('href');
setTimeout(function () {
var htmlPage = div.load(url + ' #MainContentHolder',
function () {
//other stuff
});
}, 1000);
});
However, my .aspx
page does have javascript embedded like this;
<div id="MainContentHolder">
<h1>Test Aspx Content</h1>
<div>
<script type="text/javascript">
alert("hello");
</script>
</div>
</div
When, i see the resulted HTML
, i can see the it is loaded (using firebug). But it's not showing the alert()
message
I have also read all other questions on stackoverflow
but it's not helpful on this to me;
UPDATE:
As suggested in asnwer, following code only works for the first time. I tried to turn off the cache:false
and also tried from GET
to POST
;
$.ajax({
url:url,
success:function(data){
div.html(data);
}
});