在HTML中,普通的< A>链接可能产生POST请求? [英] In HTML is it possible for normal `<A/>` link to produce POST request?
本文介绍了在HTML中,普通的< A>链接可能产生POST请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以使用HTML锚链接...
< a href =foo?bar = baz > LINK< / A>
...产生一个GET请求给 foo
使用查询参数 bar = baz
。
也可以用这种方式编写锚链接它会在HTTP请求体中编码的参数 bar = baz
产生一个POST请求给 foo
用方法POST做)?
解决方案
不是
可以使用javascript修改由anchor标记所做的请求,使用一个表单并且模拟一个表单通过设置提交按钮来锚点看起来像链接
It is possible to use a HTML anchor link...
<a href="foo?bar=baz">link</a>
...to produce a GET request to foo
with query params bar=baz
.
Is it also possible to write the anchor link in such a way that it produces a POST request to foo
with the params bar=baz
encoded in the HTTP request body (like a form with method POST does) ?
解决方案
No
Alternatives: You can modify the request made by the anchor tag using javascript,
or
use a form, and emulate a anchor by styling the submit button to look like a link
这篇关于在HTML中,普通的< A>链接可能产生POST请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文