Reputation: 7694
Using xmlhttprequest, how do I query the result using jQuery?
E.g. I am running this code snippet:
$.get('somepage.htm', function(data) {
console.log($("div.abc").text());
});
Of course $("div.abc").text() is applied to the current page, rather than the page contained in the data variable. How do I fix this and apply $("div.abc").text() to the content of data?
Upvotes: 0
Views: 49
Reputation: 943561
Create a jQuery object from the data.
var $data = $(data);
Then manipulate that:
console.log($data.find("div.abc").text())
Upvotes: 1