jquery ajax call: multiple links load data into one div

Posted by user1146939 on Stack Overflow See other posts from Stack Overflow or by user1146939
Published on 2012-04-06T06:01:48Z Indexed on 2012/11/03 11:01 UTC
Read the original article Hit count: 158

Filed under:
|

I have a dynamically generated list of links. Each link will request a different page to load. Depending on the link clicked I want it to fill the div with an ajax .load call. The thing is I want all links to reset and fill the same div. I am having trouble doing this without making a seperate div for each link, which isn't what I'm looking for.

This is what I have so far, but only works with one link.

<a data-toggle="modal" href="#myModal">Link</a>

<div class="modal hide fade" id="myModal"></div>

<script type="text/javascript">
    $(document).ready(function() {
        $('#myModal').load('mypage.php');
    });
</script>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ajax