使用ajaxSubmit提交带有文件的表单,一直执行error,是什么原因

使用ajaxSubmit提交含有文件的表单,一直执行error,是什么原因
使用ajaxSubmit提交含有文件的表单,不执行success,一直执行error,是什么原因(后台不报错,也可以进入)

function submitForm(){
var options = {
dataType : 'json',
type:'post',
url:config.baseURL + 'system/add.json',
success : function(data) {
if (data.result) {
parent.$('#win').window('close');
location.href = config.baseURL + 'pages/system/list.html';
parent.$('#dataGridUser').datagrid('reload');
} else {
$.messager.alert('系统提示', '新增失败!', 'error');
return false;
}
},
error : function(XmlHttpRequest, textStatus, errorThrown){
alert(textStatus);
}
};

$('#ff').ajaxSubmit(options);   
}
------解决方案--------------------
返回数据是什么样的?前台控制台还报错啊
------解决方案--------------------
直接用form提交就OK啊,如果有返回值,返回值会添加到<iframe>框架中,然后从<iframe>框架中取出返回值就行了
------解决方案--------------------
引用:
Quote: 引用:

返回数据是什么样的?前台控制台还报错啊
返回的数据是一个map。我也不知道怎么回事,但是后天代码又执行了......
使用ajaxSubmit提交带有文件的表单,一直执行error,是什么原因
------解决方案--------------------
<html>
<head>
<title>导入文件信息</title>
<style type="text/css">
td {FONT-SIZE: 12px; COLOR: #003366; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif}
</style>

<script type="text/javascript">
function Ok(){
  var importFile = $("#importFile");
console.log(importFile.val());
var value = importFile[0].value;
if(value.indexOf(".xls") != -1 
------解决方案--------------------
 value.indexOf(".xlxs") != -1){
var fileOperationsForm = document.getElementById('fileOperationsForm');
fileOperationsForm.action = "<%=basePath%>/server/fileOperationsAcn!importFileOperations.action";
fileOperationsForm.submit();
/* window.parent.JqueryDialog.SubmitCompleted("导入成功", true, true); */
$("#file_upload_return").load(function(){
var body = $(window.frames['file_upload_return'].document.body);
var data = eval('(' + body[0].textContent + ')');  
var ret = data.ret;
if(ret == 0){
window.parent.JqueryDialog.SubmitCompleted("导入成功", true, true);
}
if(ret == -1){
window.parent.JqueryDialog.SubmitCompleted("导入的数据格式不正确,请修改后在操作...", true, false);
}
if(ret == -2){
window.parent.JqueryDialog.SubmitCompleted("导入信息所需的数据不完整,请添加完整后在操作...", true, true);
}
});
}else{
alert("请选择以.xls或.xlxs为后缀的excel文件...");
}
}
</script>
</head>

<body>
<form id="fileOperationsForm" name="fileOperationsForm"
target="file_upload_return"
  enctype="multipart/form-data" method="post">
<table cellSpacing=0 cellPadding=0 width="98%" border=0>
<tr>
<td>请选择导入的文件:</td>
<td>
<input type="file" id="importFile" name="importFile" style="width:155px" />
<input type="hidden" id="type" name="type" value="${type}" /> 
<input type="hidden" id="typeId" name="typeId" value="${typeId}" /> 
</td>
</tr>
</table>
</form>
<iframe id="file_upload_return" name="file_upload_return"></iframe>    <!-- 提交表单处理iframe框架 -->
</body>
</html>
------解决方案--------------------
应该是你返回的数值有问题吧
------解决方案--------------------
jackson  配置好了?
------解决方案--------------------
http://snowolf.iteye.com/blog/1628861
------解决方案--------------------
from 有没有指定是data-from
------解决方案--------------------
引用:
from 有没有指定是data-from


补充 entype= ‘form-data’
------解决方案--------------------
引用:
Quote: 引用:

from 有没有指定是data-from


补充 entype= ‘form-data’


再补充 是enctype