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>

猜你喜欢

转载自www.cnblogs.com/YangGC/p/9021550.html
今日推荐