我在做一个AJAX POST调用得到一些HTML。我把HTML和它注入到DOM。一切工作很好,很正常,除了IE浏览器和其中每一个浏览器。= 8.好像IE浏览器解析传入的HTML,因为当我登录到控制台/提醒它,标签是在首都
行它删除:
<窗体类=制服ENCTYPE =多部分/表单数据行动=/型材/ editprofile /方法=邮报>
很奇怪的,因为结束标记是有,但起始标签是没有的。电话是一个标准的jQuery POST($。员额())。
更新:
最终放弃,并把它变成一个嵌入式文本区域,并重新注入到DOM:
<! - [如果其中IE 9] GT;
< TextArea类=ieHackTextArea>
<! - [如果其中IE 9] GT;
百分比抑制率ENDIF] - GT!;
...别的地方...
如果($ .browser.msie&功放;&安培; parseFloat($ browser.version)< 9){
ui.panel.innerHTML = $(。ieHackTextArea)VAL()。 // jQuery的注射不起作用
}
解决方案
我今天遇到了相同问题,并设法通过插入解决它一个空的< pre>< / pre>
权利之前的<形式GT;
,莫名其妙地停止 IE8
从去除(没有在其它版本的测试)的<形式GT;
I'm making an AJAX POST call to get some HTML. I take that HTML and inject it into the DOM. Everything works fine and dandy in every browser except for IE <= 8. It seems like IE is parsing the incoming HTML since when I log it to console/alert it, tags are in capitals.
The line it's removing:
<form class="uniForm" enctype="multipart/form-data" action="/profile/editprofile/" method="post">
Very bizarre because the end tag is there but the start tag isn't. The call is a standard jQuery POST ($.post()).
UPDATE:
Ended up giving up and putting it into an embedded textarea and reinjecting into the DOM:
<!--[if lt IE 9]>
<textarea class="ieHackTextArea">
<!--[if lt IE 9]>
<![endif]-->
... somewhere else ...
if ($.browser.msie && parseFloat($.browser.version) < 9) {
ui.panel.innerHTML = $(".ieHackTextArea").val(); // jQuery injection doesn't work
}
解决方案
I ran into the exact same problem today and managed to fix it by inserting an empty <pre></pre>
right before the <form>
, which somehow stops IE8
(haven't tested in other versions) from removing the <form>
.