好的,我花了几个小时研究这个问题,但仍然不知所措。
Internet Explorer 10将使用jQuery提交Ajax请求,但它不会包含POST数据。
以下是代码:
var ajaxData = "FirstName="+encodeURIComponent($('#FirstName').val()); //get the data from the account form
ajaxData += "&LastName="+encodeURIComponent($('#LastName').val());
ajaxData += "&EmailAddress="+encodeURIComponent($('#EmailAddress').val());
ajaxData += "&CAT_Custom_246311="+encodeURIComponent(listData);
var config = {
async: false,
type: "POST",
url: "/FormProcessv2.aspx?WebFormID=44714&OID={module_oid}&OTYPE={module_otype}&EID={module_eid}&CID={module_cid}&JSON=1",
dataType: "json", // text"json",
processData: false,
data: ajaxData,
timeout: 70000,
cache: false,
};
$.ajax(config)
.done(function(data, event) {
if(data.FormProcessV2Response.success == true){ //success field is in BC response
alert("The list was submitted sucessfully.");
console.log(XHR);
} else{
alert("An error occurred and the list was not submitted.");
}
})
.fail(function(msg,event) {
alert("An error occurred and the list was not submitted.");
});
其他浏览器(Safari,Opera,Chrome,Firefox,IE9)都可以正常运行此代码,但是在IE 10中失败了。使用fiddler查看后发现,其他浏览器和IE 10之间的头部信息几乎相同,但IE 10的请求头具有Content length值为0,且没有正文文本。
关于其他人遇到的一些问题,我没有任何类似下载管理器的插件。所有插件都是默认的。以下是我的插件截图。
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST",config.url,true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(config.data);
}
这是来自w3schools的示例文本,用于原始请求,并包含我的数据。
以下是Internet Explorer自身(使用dev工具)提供的数据值示例:
FirstName=Joe&LastName=Spacely&EmailAddress=tester%40test.com&CAT_Custom_246311=test%3Dtest
我正在使用带媒体包的 Windows 8 x64 系统上的 Internet Explorer 10.0.9200.16519。
Internet Explorer 完全不支持它吗?
如果有任何帮助,将不胜感激。哦,请不要告诉我 IE 有多糟糕。我们都知道它很麻烦,但作为网站开发人员,我们仍然必须处理它。
processData
设置为false
?看起来你正在构建数据的查询字符串。 - Mathew Thompson$_POST
数据有关?也许如果您将该信息包含在变量中并只使用静态URL,您会取得更大的成功。另外,您可以考虑使用{key:value}
配对,因为构建查询字符串很难维护。 - PlantTheIdea