I have a page with a hyperlink that when clicked, I want it to load the content from another file so the page doesn't have to refresh. The contents of the current ".container" should be replaced with the contents of ".container" from an external html file.
Here is my html
<li> <a href="#" class="loader" id="indexLink">Chris Lebeau</a>
Here is my jQuery at the bottom of the page.
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#indexLink").click(function(event) {
jQuery("div.container").html(ajax_load).load("index.html");
event.preventDefault();
});
});
When you click the first guy in the ORG chart @ http://frommesetc.com/test/org.html that .container should fade out, and the .container from index.html should fade in.
loadfunction defined? Note that you are binding the click event handler to the container, not the link. Also,<a href="load()"...will simply try to load the page with nameload(), it won't call the methodload(if that was your intent). I don't see any connection between the HTML (the link) and your JavaScript code.<a href="load()">.window.loadis not.