Mickey Patel Mickey Patel - 4 months ago 10x
jQuery Question

How to convert a GET request to POST

I don't know if it is possible or not. I referred some site, but I didn't get exact answer.

I am using
<a href="xyz?id=4"> click </a>

When I send this request to server in the response page easily I can see "id=4" in address bar, obviously which is not secure, But in post request we cant see this.

So can we convert a get request to post or ant other way is there to hide this from address bar.

Thanks in advance.

anu anu
<a href="#" onclick="postForm()"> click </a>

Dynamically create a from and post it.

function postForm() {
var form = $('<form method="POST" action="xyz"></form>');
form.append('<input type="hidden" name="id" value="4"/>');

As Racil suggested in comments, you can also do the following

<a href="#" id="postLink"> click </a>

and then

   //create form and post