![]() |
Why is IE dumb (innerHTML = xmlReq.responseText generates error)
if I have code like
Code:
function handler(){Why does IE generate an error ("Unknown runtime error") at the line where responseText is assigned to innerHTML??? Firefox works fine. I thought maybe it was because there was already a <doctype> in the page and also in the response page. But even after taking them both out, no change. It doesn't work in IE6, and I don't have 7 cause it's on a different computer now, so I haven't tried on 7. Strangely enough it allows "innerText = responseText;" to work. Could this be one of IE's lame attempts to be secure? idk. Also if you alert(responseText), it alerts the text that is supposed to respond! Why can't it just put the text in the stupid box! I don't see what is preventing the text (that is there) from going in the stupid div! Please excuse my madness, IE bugs me. Please tell me why IE does not allow this, and maybe a solution to it. Thanks, Harry :D |
Without seeing all of the code or how you are calling this. Is the page fully rendered / onload has already fired? Is this div you are putting the text into hardcoded n the page or is it dynamic.
Eric |
as stated, it's difficult without more code, but should your handler not be receiving xmlReq as it's argument?
|
the ajax works fine, it's just when...
document.getElementById("div").innerHTML = xmlReq.responseText; creates an error. if you do innerText, it works fine too, just innerHTML is the problem. Yes it (the div) is hard-coded. What could be the only reasons innerHTML being set to responseText causes an error. This is only in IE. Everything is rendered. It is just the ajax code, nothing else on the page. If you really want to see it... Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">So I guess this was a bit different problem than I originally was implying. Sorry. |
Try this
i included this line in my php script before sending the response back to the browser.
header('Content-type: text/html; charset=UTF-8'); worked for me. PS - I friggin hate IE... with a passion. |
You also shouldn't have your script in your <body> like that.
|
| All times are GMT +1. The time now is 08:13 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.