hi i have the following code, that has a problem.
Every time i load the the script the first link loads in the div, however any other links wont load in the div.
Do i need to reinitialise the script after the Ajax call.
I am not an expert in jquery, or ajax. What i am trying todo is load all links into a div.
<div id="siteloader" style="width: 900px; height: 500px;">
</div>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
jQuery(document).ready(function(){
jQuery('a').click(function(event){
event.preventDefault();
var href = jQuery(this).attr('href');
$("#siteloader").load(href);
success: initGenWidgets();
});
});
</script>
<a href='http://tired.com/'>One</a>
<a href='http://www.bbc.co.uk'>two</a>
This code:
$("#siteloader").load(href);
success: initGenWidgets();
should be changed into this:
$("#siteloader").load(href, initGenWidgets);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.