Javascript 使用Internet Explorer更新剑道下拉列表的问题
我有一个剑道下拉列表,我想通过javascript函数更新/刷新它。使用FireFox和Chrome,它可以正常工作,但使用Internet Explorer,它不会更新任何内容Javascript 使用Internet Explorer更新剑道下拉列表的问题,javascript,jquery,internet-explorer,kendo-ui,Javascript,Jquery,Internet Explorer,Kendo Ui,我有一个剑道下拉列表,我想通过javascript函数更新/刷新它。使用FireFox和Chrome,它可以正常工作,但使用Internet Explorer,它不会更新任何内容 @(Html.Kendo().DropDownList() .Name("myDDL") .HtmlAttributes(new { style = "width: 320px" }) .DataTextField("Description") .DataValueField("Id")
@(Html.Kendo().DropDownList()
.Name("myDDL")
.HtmlAttributes(new { style = "width: 320px" })
.DataTextField("Description")
.DataValueField("Id")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("fillDDL", "ControllerName");
});
})
)
javascript函数:
function refreshForm() {
$("#myDDL").data("kendoDropDownList").dataSource.read();
}
也检查过了,但运气不好
我正在使用Internet Explorer 11进行测试
有什么帮助吗
编辑
这是生成的Javascript代码:
jQuery(function () {
jQuery("#myDDL").kendoDropDownList({
"dataSource": {
"transport": {
"read": {
"url": "/ControllerName/fillDDL"
},
"prefix": ""
},
"schema": {
"errors": "Errors"
}
},
"dataTextField": "Description",
"dataValueField": "Id"
});
});
我已经找到了一个解决方案,我正在发布它,以帮助其他可能面临同样问题的人 现在我有
read.Action("fillDDL", "ControllerName").Type(HttpVerbs.Post);
而不是
read.Action("fillDDL", "ControllerName");
添加这段代码现在允许刷新DropDownList,即使在使用Internet Explorer时也是如此。调用dataSource.read的第一个函数看起来是正确的。调用时是否发出服务器请求以加载新数据?你能包括从MVC助手生成的JavaScript吗?@CodingWithSpike,检查我的编辑,除了ID与myDDL不同之外你的代码看起来是正确的。您对dataSource.read的调用是否会导致使用URL/ControllerName/fillDDL向服务器发出请求?@CodingWithSpike,我怎么知道?浏览器开发工具通常按F12,然后转到“网络”选项卡,但可能因浏览器而异。对于Chrome和IE11: