-3

Currently I am sending the data as parameter in URL.

Ex

var url = "http://localhost:8080/test?param1=" + param1Value+ "&param2="+ param2Value;

I am using XMLHttpRequest to communicated.

But by doing this I can see the params in requested URL.

How can I send the data without passing as parameter? (Basically how do I hide those data).

And on server how do I retrieve that?

1 Answers1

0

You could simply use jquery to create a POST form, fill it up, and submit it on the fly.

$("body").append("<form id='form1' action='http://localhost:8080/test' method='POST'></form>");

$("<input></input>", {
 "type": "text",
 "name": "param1",
 "value": param1Value
}).appendTo("#form1");

$("<input></input>", {
 "type": "text",
 "name": "param2",
 "value": param2Value
}).appendTo("#form1");

var theForm = $("#form1");
theForm.hide();
theForm.submit();
beliha
  • 191
  • 1
  • 6