Reputation: 4319
I'm trying to load an ajax page and based on success, i want to populate certain divs on my page with returned ajax content. How do i pull this off?
$.get('mypage',function(data){
$('#1').html($(data #1r).html()) //grab from returned content <div id="1r">blah</div>
$('#2').html(data #2r).html() //grab from returned content <div id="2r">blah</div>
});
<div id="1"></div>
<div id="2"></div>
Any help would be greatly appreciated... thanks all!
damien
Upvotes: 1
Views: 207
Reputation: 148110
Try this,
$('#1').html($(data).find('#1r').html());
Add some characters in id of div instead of using just numbers, read more about characters an id would have in this post.
The value must be unique amongst all the IDs in the element's home subtree and must contain at least one character. The value must not contain any space characters, Reference
$('#r1').html($(data).find('#1r').html());
Upvotes: 2
Reputation: 44740
Try this -
$('#1').html($(data).find('#1r').html());
$('#2').html($(data).find('#2r').html());
Upvotes: 0