How can I submit an HTTP POST request when the user clicks a normal HREF link?

Sonu TheKool

You can post to a servlet using JavaScript through HREF in the following way. Any parameters you need to send can be sent using the "hidden" parameters.

<form name="submitForm" method="POST" action="/servlet/ServletName">
<input type="hidden" name="param1" value="param1Value">
<A HREF="javascript:document.submitForm.submit()">Click Me</A>
</form>
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact