这是我的表格
<form action="<?php echo base_url();?> candidate/ajaxadd" name="candidate_form" method="post" id="candidate_form" enctype="multipart/form-data">
这些是jquery验证插件中的ajax函数
submitHandler: function(form) {
var formData = new FormData($(this)[0]);
$.ajax({
url: form.action,
type: form.method,
data: formData,
async: false,
complete: dispaly_candidate,
success: function(response) { alert(response);
if(response == "false"){
alert("Please enter all fields");
}
},
cache: false,
contentType: false,
processData: false
});
答案 0 :(得分:0)
我不明白问题,但是:
submitHandler = function(form) {
var formURL = form.attr("action");
var formData = form[0];
var formData = new FormData(formData);
$.ajax({
url: formURL,
type: "POST",
data: formData,
mimeType: "multipart/form-data",
contentType: false,
cache: false,
processData: false,
success: function(data) {
var response=$.trim(data);
alert(response);
if(response === "false"){
alert("Please enter all fields");
}
}
});
};
// use finction:
submitHandler($("#candidate_form"));
您需要详细询问问题。而且这个功能是一个(我猜)你正在寻找的修正。