超链接<a href=""> using POST Method instead of GET method

时间:2017-08-02 06:07:50

标签: javascript php html hyperlink

As i know, all hyperlink working as GET method. But I wanna make a hyperlink which should be in POST method instead of GET Method <a href='targetpage'>click</a>

Note: I don't want to submit any form. I SHOULD BE ONLY <a> TAG

So is it possible?

Thanks

2 个答案:

答案 0 :(得分:1)

如果由html调用,post方法只能由表单数据使用。

因此,唯一的解决方案是制作表单并隐藏您要发布的输入,并将帖子提交到您想要的网址。

答案 1 :(得分:-2)

你可以这样做,

<form id="form" method="post" action="target.html">
  <input type="hidden" name="name" value="value" /> 
  <a onclick="document.getElementById('form').submit(); return false;">click here</a> 
</form>