Reputation: 2404
This is my whole Ajax page which is returned
<!DOCTYPE div PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<div class="CareerAjaxData">Simple Div Content</div>
The jQuery script in the Main page which calls this Ajax page is
$.ajax({
type : 'POST',
url : url,
data : data,
datatype : 'html',
success : function(ajaxdata) {
var $tabcontent = $(ajaxdata).find('.CareerAjaxData');
console.log($tabcontent.html());
}
});
But the output of Console gives: undefined
I get proper response from the server. But there some problem with js I guess.
whats wrong here..??
Upvotes: 0
Views: 435
Reputation: 2404
After wasting half a day.. I found the answer at https://stackoverflow.com/a/405700/920271.
Yes doctype
was a typo.. but that wasn't the problem.
Using filter
instead of find
helped me.!
Upvotes: 1
Reputation: 11175
I don't know what type of doctype
you are using. I have never seen that before. I would try a normal
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
As far as jQuery
, try this:
$('#tabcontent').load('url .CareerAjaxData');
Upvotes: 0