Having issues when trying to insert an ajax response which is an html block into an element on IE 8

Posted by user340812 on Stack Overflow See other posts from Stack Overflow or by user340812
Published on 2010-05-14T00:46:58Z Indexed on 2010/05/14 0:54 UTC
Read the original article Hit count: 258

Filed under:

Hello Everyone just like my title states, I am having issues with IE8 and innerHTML. For whatever reason, when I make an ajax call which returns an html block and try to insert it into an element using innerHTML, the browser gives me an error "Unknown Error Code: 0".

The interesting part of this is that, if the message response does not have html element, innerHTML works. My code is like so:

setTimeout(function() {

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

WORKS:

context.response.message = 'String';

Does not WORK:

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

© Stack Overflow or respective owner

Related posts about JavaScript