【发布时间】:2014-11-19 02:11:49
【问题描述】:
这是我的代码
$.ajax({
type: 'post',
url: '../lib/upload.php',
data: new FormData( $("#niceidentifier") ),
processData: false,
contentType: false,
success: function (response) {
if(response == 'success') {
return true;
}
else {
alert(response);
console.log(response);
}
}
});
HTML 表单只是基本的 HTML(包括 enctype 和方法发布),但不幸的是没有传递任何数据。如何上传文件并传递输入数据一次?
【问题讨论】:
-
@Kami 所以我必须为每个输入字段执行“form_data.append”?就算不是文件?
-
#niceidentifier 是表单的id?
-
@SebriZouhaier 不,这是表单的 ID
标签: javascript php jquery html ajax