Having problems trying to insert an ajax response which is an html block into an IE 8 element using innerHTML

Hi everyone. As my titles say I am having problems with IE8 and innerHTML. For some reason, when I make an ajax call that returns an html block and tries to insert it into an element using innerHTML, the browser gives me an "Unknown error code: 0" error.

The interesting part of this is that if there is no html element in the post response, innerHTML works. My code looks like this:

setTimeout(function() {

 element.innerHTML = context.response.message;
}, 1000).bind(context)

      

WORKING:

context.response.message = 'String';

      

Does not work:

context.response.message = '<p>String</p>';

      

+2


a source to share


1 answer


Ok, I figured out that ... For some reason IE8 and IE7 don't like:

Problem:
<p>Hi
   <p>Hi again</p>
</p>

Fix:
<div>Hi
   <p>Hi again</p>
</div>

      



Firefox doesn't seem to care if you paste p tags, however IE 8 and 7 poop on itself :(.

Thanks for your reply.

0


a source







All Articles