Dhirendra Dhirendra - 8 months ago 74
HTML Question

Using the POST Method with HTML Anchor Tags

I am certain the answer will be 'NO', but I wanted to ask anyway just
incase I have missed something.

Everyone knows that one pass data to a page in an anchor tag by using
the GET Method:

What I am wondering is if there was a way to do the same thing, but use
the POST Method instead...?

My purpose in doing so is to keep the URLs the user sees clean by not
putting anything in them that they do not need to see.

This has nothing to do with security concerns as I already know there
would be ways to obtain the data being passed.

If the answer is indeed no, then what methods do people use to pass data
when there is a desire to keep the URLs clean? Cookies? Something else?

and how to deal with the scenarios when the URL length exceeds the permissable Get Request length

I am facing this issue while implementing sorting/pagination with displaytag, all the request parameters are appending in the sort/pagination url which is more then the permissable length of the Get Request


You could do something like this:

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