load dynamic pages into div
- Started
- Last post
- 4 Responses
- dbloc
I am new to jquery/ajax
I am looking for a tutorial to load dynamic pages into a div when a link is clicked.
I've found a few, but can't seem to get them to work correctly.
Thanks!
- supersimple0
$("#div_id").load('pagename.php...
essentially, this is what you are gonna do.
- dbloc0
found this....
<ul>
<li><a href="page1.html" class="dynamicLoad"></a></li>
<li><a href="page2.html" class="dynamicLoad"></a></li>
<li><a href="page3.html" class="dynamicLoad"></a></li>
</ul><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$( '#myDiv' ).load( $( this ).attr( 'href' ) );
});
});
</script>
- dbloc0
^ this works
- ********0
ur gay.