j2ee之页面无刷新上传附件
//上传附件 var uploadAnnex = function(){ //alert("??"); //document.getElementById('submitFile').onclick = function(event){ var applicationId = $("#applicationId").val(); if(event.preventDefault){//取消按钮默认提交行为 event.preventDefault(); } else { event.returnValue = false; } var formDOM = document.getElementById('fileForm'); var formData = new FormData(formDOM);//创建formData对象 var req = new XMLHttpRequest(); req.open("POST", baseUrl +"/suspicious/upLoadFile?applicationId="+applicationId);//使用POST发送请求 req.onload = function(event){ if(this.status === 200){ console.log(this.response);//请求成功后打印返回的结果 } } req.send(formData); req = null; //} }