java web前端發送請求的4種方式


 

表單 action, 鏈接href,js 綁定按鈕 ajax綁定標簽

<h1>通過表單提交參數</h1>
        <form action="/day46_v1/ServletDemo01?method=addUser" method="post">
            用戶名:<input type="text" name="username"/><button>提交</button>
        </form>
        <h1>通過鏈接提交參數</h1>
        <a href="/day46_v1/ServletDemo01?method=delUser&uid=003">刪除</a>
        <h1>通過Ajax提交參數</h1>
        <input type="text" name="username"/><button onclick="fn()">發送請求</button>
        <h1>通過JS發送請求</h1>
        <button onclick="fm()">點擊我向服務端發起請求</button>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM