我有formData包含文件(不在表单中)和表单模型对象,现在我想通过formData将模型对象传递给控制器,我尝试过不同的方法,但没有得到..
var data = formData; // Which contains files which are not in the form.
var model = $("#formAddEmployees").serializeArray();
$.ajax({
type: "POST",
url: '/Employer/AddEmployees?model='+model,
data:data,
success: function (data) {
alert("success");
},
error: function (error) {
alert("Error");
}
});
public ActionResult AddEmployees(ModelClass model)
{
if (Request.Files.Count > 0) //Not Getting
{
}
return Json("",JsonRequestBehaviour.AllowGet);
}
我上面尝试过,但是formData不是...... !!请帮助任何人..