10条回答
  • 2020-12-04 02:01

    Basically, you can't use an anchor tag for a POST request. However, there is a simple hack to achieve this.

    <form id="myform" method="post" action="target.html"></form>
    <a onclick="document.getElementById('myform').submit();">Submit to action</a>
    

    I have tested this and already using it in our production code.

    0 讨论(0)
  • 2020-12-04 02:01

    Simple answer: no. You need to use javascript to do this kind of thing; since when you do a POST what you're doing is sending the data in the HTTP request. With get you're just sending it as part of the string (thus you can do it through the href value).

    0 讨论(0)
  • 2020-12-04 02:08

    No clearly not without a javascript submit().

    0 讨论(0)
  • 2020-12-04 02:11

    No there's no way to do this without the use of scripting. Although you can use CSS to style a standard Submit button to look and act more like an tag.

    0 讨论(0)
提交回复
热议问题