Im using this code:
<!--Page Loading Mechanism-->
<script type="text/javascript">
$( document ).ready( function() {
$( 'a.dynamicLoad' ).click( function( e ) {
e.preventDefault(); // prevent the browser from following the link
e.stopPropagation(); // prevent the browser from following the link
$( '#MainWrapper' ).load( $( this ).attr( 'href' ) , function() {
/* Content is now loaded */
});
});
});
</script>
to load in external pages using a navigation menu in the parent page. Ok, now it loads the pages fine when i click on the nav buttons.
Now, what im trying to do is load another external page into this same div from a button on the child page. Im trying to basically overwrite the child with thew page. I thought a regular < a href>
would do the trick, but it does nothing but opens the new page into the main window, replacing the parent page. I dont want that.
How do I replace the first child page, with the new external page, but into the same div the child was already loaded, replacing it. What code would I write on the first loaded child page?
I pray you all are not confused reading this, as this is t开发者_C百科he best way i could explain it.
See if this works for you, of course if using ajax is OK..
$.ajax({url:"url",
success : onSuccess
});
function onSuccess(result){
$("#<id of div to be updated>").html(result);
}
精彩评论