Reputation: 992
I used this query to make the ajax call
$j.ajax({
url: durl,
context: document.body,
dataType: 'html',
complete: function(data) {
console.log(data.responseText);
var aa = $j(data).filter('#outputMessage').text();
console.log(aa);
}
});
the response text printed on the console has
<div id ="outputMessage">
Could not process transactions.
</div>
i used both filter and find which prints empty string on the console. Am i doing something wrong here . How can i get the div content message from the ajax response
Upvotes: 0
Views: 67
Reputation: 992
After trying lot of things , I finally figured it out by using like this
$j(data.responseText).filter('#outputMessage').text()
Upvotes: 0
Reputation: 189
Have you tried like below ?
var aa = $j(data.responseText).html();
console.log(aa);
Upvotes: 0
Reputation: 133403
As data.responseText
has the required content.
You need to use
$j(data.responseText).find('#outputMessage').text()
instead of
$j(data).find('#outputMessage').text()
Upvotes: 1