<iframe id="iframe1" name="ifra1" style="display: none"></iframe> <form id="fm1" action="/app04/ajax1/" method="POST" target="ifra1" enctype="multipart/form-data"> <input type="text" name="k1"/> <input type="text" name="k2"/> <input type="file" name="k3"/> <a style="background-color: red" onclick="AjaxSubmit8()">上传文件2</a> </form> function AjaxSubmit8() {//第三种方式:iframe+form文件上传(经常用到) //提交之前绑定 document.getElementById('iframe1').onload=reload1; document.getElementById('fm1').submit() } function reload1() { var content = this.contentWindow.document.body.innerHTML;//this代表iframe标签 var obj=JSON.parse(content);//转换成json对象 console.log(obj) }