2 回答

TA贡献1827条经验 获得超4个赞
你要是用原生的form提交,肯定是要跳转的
你要么自己直接用xmlhttprequest/fetch创建请求(把form提交事件屏蔽),要么自己写个ajax什么的

TA贡献1770条经验 获得超3个赞
<form id="form" action="http://*/api/gateway" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="upload_file">
<input type="hidden" name="appKey" value="appKey">
<input type="hidden" name="pampasCall" value="pampasCall">
<input type="hidden" name="pathName" value="pathName">
<input type="hidden" name="sign" value="signs">
<input type="hidden" name="timestamp" value="timestamp">
<button onclick="submit()">提交</button>
</form>
function submit(){
$('#form').submit();
return false;
}
添加回答
举报