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