炎炎设计
FormData对象进行append的应该是file对象,不是一个inputajax("/test",oV1.files[0],function(str){});此外,最好是先绑定监听,然后再sendfunction ajax(url,data,funsucc){ var oAjax=new XMLHttpRequest(); oAjax.open('post',url,true); oAjax.setRequestHeader("Content-Type","multipart/form-data"); var form=new FormData(); form.append("pic",data); oAjax.onreadystatechange=function(){ if(oAjax.readyState==4){ if(oAjax.status==200){ funsucc(oAjax.responseText); } } } oAjax.send(form);}