【发布时间】:2014-02-06 01:22:36
【问题描述】:
这是我的表格
<form name="uploadImg" id="uploadImg" class="profile-image" enctype="multipart/form-data">
<input type="file" name="profile" id="updProfileImg">
</form>
这是我的 jquery 事件
$("#updProfileImg:file").change(function() {
$('#uploadImg').submit(function() {
var queryString = new FormData($('form')[0]);
$.ajax({
type: "POST",
url: 'index.php?route=account/edit/upload',
data: queryString,
contentType: false,
processData: false,
beforeSend: function() {
},
success: function() {
}
})
})
})
但是更改事件没有触发表单提交,所以我尝试了trigger('submit'),但页面正在刷新而不是在 ajax 中提交。
【问题讨论】:
-
尝试切换返回功能?