I have a jquery function which makes an ajax call to a webservice method on the web server, the method returns a html table with data. I am using .html() to render the return va
It seems IE8 has problems inserting long strings of text with jQuery's html(), making the div's content just completely blank. Just tried it with both a very long string and one containing just 'blah', and that made all the difference.
So if you're expecting very large chucks of text (like 2k+ characters), go for the native innerHTML. Didn't do any further research, so I don't know what's the max length of a string to be passed through html() in IE8.
Whether its .html() that is not working or its something else, check it first. Put an alert and see if you get correct, expected html or not.
alert(data.d[1]);
$("#dvProudctInstruction").html(data.d[1]);
Most likely the html coming in data.d[1] contains error and IE is not able to resolve it.
You could alert your response before assigning it html()
OR
You could use innerHTML property instead html() of jquery (though it's same)
And you might want to check this link
i have answered this problem on link you just need to change your code to be like this
$("#dvProudctInstruction").html(data.d[1].toString());
Have you tried setting data.d[1]
to a variable and then adding it?
For Example:
if (data.d[0] == "true") {
var results = data.d[1];
$("#dvProudctInstruction").html(results);
}
Just a gut feeling, but are you sure that you enter the if-block at all? I am just asking having stumbled in true vs "true" a couple of times myself...
Try:
success: function(data) {
alert('outside of if');
if (data.d[0] == "true") {
alert(data.d[1]);
$("#dvProudctInstruction").html(data.d[1]);
}
}
Might not be anything, but at least you would eliminate the possibility that you'd simply never run the code line you've highlighted.