nunu
nunu

Reputation: 2871

Confusing in load external page into a div

I have some divs like:

<div id="menu">
     <ul>
         <li><a href="link.htm">next</a></li>
     </ul>
</div>

<div id="content"></div>

and the script in another page link.htm:

<div id="data">
     <ul>
         <li><a href="slide.php">Slide</a></li>
     </ul>
</div>

I want to load link.htm page inside the content div's, but i'm just know to load some image:

$('ul li a').click(function(){
                        var data = $(this).attr('href');
                        $('#content').html('<img src="'+data+'" />');
                        return false;
                        });

how should I change for load external page into the div?

Upvotes: 0

Views: 744

Answers (1)

Sotiris
Sotiris

Reputation: 40096

This will load the specific div, #data, in the #content.

$('a').click(function(){
    var data = $(this).attr('href');
    $('#content').load(data+'#data');
    return false;
 });

For more information look at the documentation of jQuery: http://api.jquery.com/load/

Upvotes: 1

Related Questions