Ajax调用不会出现在IE 11中,但在部署之后会出现chrome,FF [英] Ajax call not coming in IE 11 but comes in chrome, FF, edge after deployment

查看:86
本文介绍了Ajax调用不会出现在IE 11中,但在部署之后会出现chrome,FF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个telerik模态弹出窗口。在弹出窗口中有一个telerik radgrid。单击按钮时,将调用下面的ajax,并在返回数据时填充radgrid。



< script type =text / javascript>

函数OnSeriesClick(args){

var kendoWidget = args.sender;

var operationCount = args.value;

var operationType = args.category;

var userName = document。 getElementById(<%= ddlUsers.ClientID%>)。value;

var startDate = document.getElementById(<%= RadDateTimePicker1.ClientID%>)。value;

var endDate = document.getElementById(<%= RadDateTimePicker2.ClientID%>)。value;

var jsonData ={'OperationType':'+ operationType +','UserName':'+ userName +','StartDate':'+ startDate +','EndDate':'+ endDate +'};

var GridData;



jQuery.ajax({

类型:'POST',

contentType:' APPLICA / json; charset = utf-8',

数据:jsonData,

cache:false,

dataType:'JSON',

url:'ListView.aspx / GetFileNames',

成功:函数(结果){



GridData = result.d;



if(GridData.length> 0){

var divGridContainer = document.getElementById('divGridContainer');

divGridContainer.style.display =block;

var tableView = $ find(<%= RadGrid1.ClientID%>)。get_masterTableView();

tableView.set_dataSource(GridData);

tableView.dataBind( );

alert('grid filled');

}

else {

var divGridContainer = document。 getElementById('divGridContainer');

divGridContainer.style.display =none;

alert('grid not filled');

}

},

错误:function(){

alert('绑定数据时出错');

}

});



var oWnd = $ find('<%= modalPopup.ClientID%>') ;

document.getElementById('<%= txtUser.ClientID%>')。value = userName;

oWnd.show();

}

< / script>



在调试模式下,ajax调用在所有已知浏览器中都取得了成功显示填充网格数据的模式弹出窗口。

在IIS 8中部署项目后,ajax调用在Chrome,Edge和FF浏览器中获得成功,并且填充网格数据的模式弹出窗口正在显示但是网格没有填补IE。在IE中它显示警报('网格未填充')。

我检查了IE并看到ajax调用被调用并且响应为200但是if(GridData.length> 0)它失败了。

我不知道该做什么,因为在IE中调试它的工作正常但是在部署之后它没有。

任何帮助都非常感谢。谢谢。



我尝试了什么:



我不喜欢我知道该尝试什么,因为我第一次面对这个问题。我搜索了很多,但每个人都面对这个关于CORS的问题。但在我的情况下它不是CORS,因为ajax是从页面后面的代码调用的。

I have a telerik modal popup. In the popup there is a telerik radgrid. On clicking a button the below ajax gets called and the radgrid gets filled if data is returned.

<script type="text/javascript">
function OnSeriesClick(args) {
var kendoWidget = args.sender;
var operationCount = args.value;
var operationType = args.category;
var userName = document.getElementById("<%= ddlUsers.ClientID %>").value;
var startDate = document.getElementById("<%= RadDateTimePicker1.ClientID %>").value;
var endDate = document.getElementById("<%= RadDateTimePicker2.ClientID %>").value;
var jsonData = "{ 'OperationType':'" + operationType + "', 'UserName':'" + userName + "', 'StartDate':'" + startDate + "', 'EndDate':'" + endDate + "' }";
var GridData;

jQuery.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: jsonData,
cache: false,
dataType: 'JSON',
url: 'ListView.aspx/GetFileNames',
success: function (result) {

GridData = result.d;

if (GridData.length > 0) {
var divGridContainer = document.getElementById('divGridContainer');
divGridContainer.style.display = "block";
var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
tableView.set_dataSource(GridData);
tableView.dataBind();
alert('grid filled');
}
else {
var divGridContainer = document.getElementById('divGridContainer');
divGridContainer.style.display = "none";
alert('grid not filled');
}
},
error: function () {
alert('Error on binding the data');
}
});

var oWnd = $find('<%= modalPopup.ClientID %>');
document.getElementById('<%= txtUser.ClientID %>').value = userName;
oWnd.show();
}
</script>

While in debug mode the the ajax call is getting success in all known browsers and the modal popup with filled grid data is showing.
After deploying the project in IIS 8 the ajax call is getting success in Chrome, Edge and FF browsers and the modal popup with filled grid data is showing but the grid is not getting filled in IE. In IE it is showing the alert('grid not filled').
I inspected the IE and saw that the ajax call is getting called and gives response of 200 but in if (GridData.length > 0) it is getting failed.
I don't know what to do as while debugging in IE its working fine but after deployment its not.
Any help is much appreciated. Thank you.

What I have tried:

I don't know what to try because I am facing this issue for the very first time. I searched a lot but every where people face this issue regarding CORS. But in my case its not CORS because the ajax is getting called from code behind page.

推荐答案

find(<%= RadGrid1.ClientID%>) .get_masterTableView();

tableView.set_dataSource(GridData);

tableView.dataBind();

alert('grid filled');

}

else {

var divGridContainer = document.getElementById('divGridContainer');

divGridContainer.style .display =none;

alert('grid not filled');

}

},

错误:function(){

alert('绑定数据时出错');

}

});



var oWnd =
find("<%= RadGrid1.ClientID %>").get_masterTableView();
tableView.set_dataSource(GridData);
tableView.dataBind();
alert('grid filled');
}
else {
var divGridContainer = document.getElementById('divGridContainer');
divGridContainer.style.display = "none";
alert('grid not filled');
}
},
error: function () {
alert('Error on binding the data');
}
});

var oWnd =


find('<%= modalPopup.ClientID%>');

document.getElementById('<%= txtUser.ClientID%>') .value = userName;

oWnd.show();

}

< / script>



在调试模式下,ajax调用在所有已知浏览器中都取得了成功,并且显示了带有填充网格数据的模式弹出窗口。

在IIS 8中部署项目后ajax呼叫在Chrome,Edge和FF浏览器中取得了成功,并且显示了带有填充网格数据的模式弹出窗口,但网格未在IE中填充。在IE中它显示警报('网格未填充')。

我检查了IE并看到ajax调用被调用并且响应为200但是if(GridData.length> 0)它失败了。

我不知道该做什么,因为在IE中调试它的工作正常但是在部署之后它没有。

任何帮助都非常感谢。谢谢。



我尝试了什么:



我不喜欢我知道该尝试什么,因为我第一次面对这个问题。我搜索了很多,但每个人都面对这个关于CORS的问题。但在我的情况下,它不是CORS,因为ajax是从页面后面的代码调用的。
find('<%= modalPopup.ClientID %>');
document.getElementById('<%= txtUser.ClientID %>').value = userName;
oWnd.show();
}
</script>

While in debug mode the the ajax call is getting success in all known browsers and the modal popup with filled grid data is showing.
After deploying the project in IIS 8 the ajax call is getting success in Chrome, Edge and FF browsers and the modal popup with filled grid data is showing but the grid is not getting filled in IE. In IE it is showing the alert('grid not filled').
I inspected the IE and saw that the ajax call is getting called and gives response of 200 but in if (GridData.length > 0) it is getting failed.
I don't know what to do as while debugging in IE its working fine but after deployment its not.
Any help is much appreciated. Thank you.

What I have tried:

I don't know what to try because I am facing this issue for the very first time. I searched a lot but every where people face this issue regarding CORS. But in my case its not CORS because the ajax is getting called from code behind page.


这篇关于Ajax调用不会出现在IE 11中,但在部署之后会出现chrome,FF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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