I have an Ajax functions which returns html markup. I need to extract a certain div form the entire string and replace that same div in my current html.
this is part of the code:
$.ajax({
type: "POST",
url: postUrl,
dataType: "HTML",
data: "ddd"
success: function(htmlResponse) {
//replace the html code
$('#somediv').html($('#somediv' htmlResponse).html());
}
},
Works fine in Chrome and FF, not in IE 8. IE doesn’f find the div in the htmlResponse. i tried alerting:
alert($(htmlResponse).find('#somediv').html());
and got a blank message.
Is this a bug in IE, is anything wrong in my code?
Thanks 8
Regarding the
alert, I can’t think of why IE would break onalert($(htmlResponse).find('#somediv').html());unless the html() that was grabbed was just oversized / too much whitespace / empty in the first place.However, on this line:
did you mean:
?
Edit:
It might be a good idea to analyze the HTML in
htmlResponse, and make sure it is well formed. Maybe a<div>doesn’t close, or other invalid syntax that IE8 is having trouble with.