标签:multipart else return pdf document xmlhttp style ror ret
$("#file").off("change").on("change",function(){
var inputFile = $(‘#file‘).get(0).files[0];
if(inputFile && (inputFile.name.endsWith("doc") || inputFile.name.endsWith("docx"))){
$("#span").html(inputFile.name);
}else{
window.wxc.xcConfirm("请上传word文件!", "error");
return ;
}
});
<form id="addForm" class="form-horizontal" enctype="multipart/form-data">
<input type="file" accept="application/pdf" id="file" name="file" style="display:none">
</form>
$("#BA_Btn").click(function(){
var s=$("#span").html();
var form = new FormData(document.getElementById("addForm"));
$.ajax({
type: "POST",
url: "<%=basePath%>backend/sjxq/add",
data: form,
async: false,
processData: false,
contentType: false,
success: function (result) {
window.history.back();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
window.wxc.xcConfirm("保存失败", "error");
return ;
},
});
});
标签:multipart else return pdf document xmlhttp style ror ret
原文地址:https://www.cnblogs.com/foreverstudy/p/12744281.html