I have one main html file which looks like this:
<head>
css here
</head>
<body>
<div class="nav">
....
</div>
<div id="mainpage-load">
<div id="loading">
<img src="./img/loading-white.gif">
</div>
</div>
<script> jquery </script>
<script> slider.js </script>
<script> ... </script>
<script> APP.JS </script>
i want to dynamically load content into the div "mainpage-load". but when i load the content with jquery/ajax .load into the div, the javascript file for a slider for example is not effecting the new content.
app.js to load content:
$(function(){
var $loading = $('#loading').hide();
$(document)
.ajaxStart(function () {
$loading.show();
})
.ajaxStop(function () {
$loading.hide();
});
$('#load-it').on('click', function(e){
e.preventDefault();
$( "#mainpage-load" ).load( "pages/main.html" );
})
});
2nd html file (pages/main.html):
<div class="new content">
new content here
</div>
i tried putting app.js and jquery into the but still not working or putting the slider.js in the pages/main.html
thanks in advance !