ajaxSubmit ajax上传文件
作者:chrispy
Html:<script src="jquery.form.js" type="text/javascript"></script><form id="upload-excel-form" action="/Home/UploadCase/uploadCase" method="post" enctype="multipart/form-
Html:
<script src="jquery.form.js" type="text/javascript"></script>
<form id="upload-excel-form" action="/Home/UploadCase/uploadCase" method="post" enctype="multipart/form-data">
<input name="file" type="file" class="upload-excel" value=""> //file 必须有name
</form>
Js:
$('#upload-excel-form').ajaxSubmit({
data: { "client_company_id" : $("#fbgs").attr("value") , "mortgage_type" : $("#zwlx").attr("value")},
dataType: 'json',
success: function(data) {
if(data.success){
$('.loading-text').html('Excel上传成功!');
}else{
alert(data.message);
}
}
});