背景
我想提交一份表格,待在同一个页面上,得到回复。
下面提到的代码在Chrome、Safari和Firefox中运行得很好。但是,它在IE10中不起作用。
如何使它在IE10中工作?
My Analysis correctness=“可疑”
在IE10中,$('#amazonUpload').ajaxSubmit(options)被执行,但是服务器上没有接收到Ajax请求,因此客户端从来没有接收到响应。
<form action="https://s3.amazonaws.com/adminportal" enctype="multipart/form-data" id="amazonUpload" method="post">
<input name="key" type="hidden" value="001e0000009vkRLAAY/Forms/${filename}" />
<input name="AWSAccessKeyId" type="hidden" value="client aws key" />
<input name="policy" type="hidden" value="really long string" />
<input name="signature" type="hidden" value="sign value=" />
<input name="acl" type="hidden" value="private" />
<input name="Content-Type" type="hidden" value="application/octet-stream"/>
<div id="uploadPage:block:j_id31"><div class="pbSubsection">
<input id="uploadfileOne" name="file" required="True" size="25" type="file" />
<input class="btn" id="myBtnId55" name="myBtnId55" onclick="uploadActComplete();" style="display:none;" type="button" value="Upload" />
</form>JavaScript
function uploadActComplete(){
loading();
var options = {
// error: errorResponse,
// success: successResponse,
complete: function(xhr, status) {
alert('status is :- '+status );
if(status =='success')
successResponse(xhr, status);
else if(status =='error')
errorResponse(xhr, status);
}
};
$('#amazonUpload').ajaxSubmit(options);
return false;
}
function errorResponse(xhr, status) {
stoploading();
alert('File could not be uploaded, please try again.');
}
function successResponse(xhr, status) {
stoploading();
$("input[id$='invisiblesubmit']").click();
}发布于 2013-09-19 11:51:10
我试过在我的系统上复制你的代码。就像一种魅力..。
我使用了以下jquery文件来实现上述功能。
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>请检查是否使用了正确的jquery文件。
我还尝试将文章发送到本地文件,并在那里正确地接收到ajax请求。
发布于 2013-09-17 16:33:46
你试过这个吗?
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" >更多信息在这里:http://code.gishan.net/code/solution-to-ie10-ajax-problem/
@丹尼尔·施瓦兹也回答了。:)
发布于 2013-09-16 13:16:14
尝试在页面的头标签中添加元标签,这对我有用:-
<meta http-equiv="x-ua-compatible" content="IE=9" >IE10的工作方式类似于IE9
https://stackoverflow.com/questions/18764885
复制相似问题