ajax表單提交 同步上傳文件

前端之家收集整理的这篇文章主要介绍了ajax表單提交 同步上傳文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. var form = new FormData(document.getElementById("friendshipCooperationFrom"));
  2.  
  3. $.ajax({
  4. url:"<%=basePath%>${action }",type:"post",data:form,processData:false,contentType:false,success:function(data){
  5. alert(data);
  6. },error:function(e){
  7. alert("错误!!");
  8. }
  9. });
  10.  
  11.  
  12. new FormData();

from表單無法序列化文件,使用FormData

猜你在找的Ajax相关文章