<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<button id="aa">上传</button>
<form id="ajaxUploadform" action="/api/upload" role="form" method="post" target="ajaxIframe" enctype="multipart/form-data">
<input type="file" id="ajaxFile" name="ajaxFile"/></form>
<iframe name='ajaxIframe' id='ajaxIframe' ></iframe>
<script>
var aa=document.getElementById("aa");
aa.addEventListener("click",function(){
document.getElementById("ajaxUploadform").submit()
document.getElementById("ajaxIframe").onload=function(){
var result=document.getElementById('ajaxIframe').contentWindow.document.body.innerText;
alert(result)
}
},false)
</script>
</body>
</html>