1. 程式人生 > 其它 >YDOOK:Sanic: input 請求點選提交確認後頁面不跳轉 詳細教程

YDOOK:Sanic: input 請求點選提交確認後頁面不跳轉 詳細教程

技術標籤:Websanicinput頁面跳轉YDOOKJYLin

YDOOK:Sanic: input 請求點選提交確認後頁面不跳轉 詳細教程

1. HTML 前端程式碼: 改進前:

<form action="/api/url1" method="post">
	<input class="inputBox" type="text" name="content" value="123" />
	<input class="inputBtn"
type="submit" value="OK">
</form> <iframe name="none_iframe" style="display:none;"></iframe>

2. 改寫方案:

1. 在 《form》開始標籤內,新增:target=“none_iframe”

2. 新建 《iframe 》開始標籤內,新增:name=“none_iframe” 與 style=“display:none;”

3. 以上的 none_iframe 字串可以自己定義。


3. HTML 前端程式碼: 改進後:

<form action="/api/url1" method="post" target="none_iframe">
	<input class="inputBox" type="text" name="content" value="123" />
	<input class="inputBtn" type="submit" value="
OK"
>
</form> <iframe name="none_iframe" style="display:none;"></iframe>