jquery ajax上传文件
<form action="" id="upfile" name="upfile" method="post" enctype="multipart/form-data"> 上传:<input type="file" id="file" name="file" /> <input type="button" onclick="import_send();" value="发放" /> </form>
//导入并发放 function import_send(){ var formData = new FormData(); var files = $('input[name="file"]').prop('files'); formData.append("file",files[0]); $.ajax({ url : "importSendMember?cardId="+<c:out value='${cardId }' />, type : 'POST', data : formData, // 告诉jQuery不要去处理发送的数据 processData : false, // 告诉jQuery不要去设置Content-Type请求头 contentType : false, beforeSend:function(){ console.log("正在进行,请稍候"); }, success : function(result) { alert(result["message"]); }, error : function(r) { alert(result["message"]); } }); }
相关推荐
TONIYH 2020-07-22
83510998 2020-07-18
wcqwcq 2020-06-26
delmarks 2020-06-14
ppsurcao 2020-06-14
tthappyer 2020-06-07
kentrl 2020-11-10
结束数据方法的参数,该如何定义?-- 集合为自定义实体类中的结合属性,有几个实体类,改变下标就行了。<input id="add" type="button" value="新增visitor&quo
ajaxyan 2020-11-09
zndy0 2020-11-03
学留痕 2020-09-20
Richardxx 2020-11-09
learningever 2020-09-19
chongxiaocheng 2020-08-16
ajaxhe 2020-08-16
lyqdanang 2020-08-16
curiousL 2020-08-03