IE浏览器< = 8移除<形式GT;从AJAX接收时标签 [英] IE <= 8 removes <form> tag when received from AJAX

查看:78
本文介绍了IE浏览器< = 8移除<形式GT;从AJAX接收时标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个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>.

这篇关于IE浏览器&LT; = 8移除&LT;形式GT;从AJAX接收时标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆