Reputation: 715
This is probably simple but I've never had to do it. I'm loading another page on the site and want to extract the html from a div with the id of terms_text.
So I am loading the data (it's there no problem), and am trying to filter it but am receiving undefined for my $html variable. Any ideas?
function test () {
$.get("/terms?" + new Date().getTime(), function(data){
var $html = $(data).filter('#terms_text').html();
alert($html);
});
}
Upvotes: 1
Views: 80
Reputation: 5827
You probably need to use $(data).find('#terms_text')
instead of $(data).filter('#terms_text')
. Either that or there just is no element returned in /terms...
with the id terms_text
Upvotes: 1