jQuery的AJAX可以不填在Internet Explorer中选择框 [英] jQuery AJAX can't fill select box in Internet Explorer

查看:123
本文介绍了jQuery的AJAX可以不填在Internet Explorer中选择框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些code是这样的:

I have some code like this:

var mySelect = document.getElementById("mySelect");
mySelect.innerHTML = "<option>Loading...</option>";
$.get("ajaxPage.php", {"args":args}, function(r) {
    mySelect.innerHTML = r;
});

Ajax响应是这样的:

The ajax response is something like this:

<option value="1">Option 1</option>
<option value="2">Option 2</option>

和它的作品优雅的镀铬,极光/火狐,Opera和Safari(我测试过各一个),但IE9不服的响应。

And it works gracefully in Chrome, Aurora / Firefox, Opera and Safari (I've tested each one), but IE9 refuses to accept the response.

在看IE9的检查元素窗口(我不知道到底它的名字),我可以看到IE9试图呈现响应,一个简单的文本节点,如:

After looking at IE9's 'Inspect Element' window (I don't know exactly its name) I could see IE9 tries to render the response as a simple text node, such as:

Option 1Option 2

和为什么发生这种情况是什么缠着我。

And why that happens is what is bugging me.

我,如果这是已经在这里了质疑,我做了一些搜索,可以看到没有答案,可以帮助我很抱歉。

I'm sorry if that was already questioned here, I did a little searching and could see no answers that could help me.

TIA,安德烈

推荐答案

这一直是IE的Bug,只要我还记得: http://support.microsoft.com/kb/276228

This has been an IE bug for as long as I can remember: http://support.microsoft.com/kb/276228

我认为JQuery的相当于有错误修正:

I think that the JQuery equivalent has the bug fixed:

mySelect.innerHTML = r;
//change to
$(mySelect).html(r);

这篇关于jQuery的AJAX可以不填在Internet Explorer中选择框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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