Issue
I am trying to create an AJAX request that sends a string value to a Java servlet.
In the AJAX code I had:
xhttp.open("GET", link, true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("foo=bar&lorem=ipsum");
in the java servlet that handles the request i tried using request.getParameter("foo")
hoping to get the values "bar". How can I get the values within the .send method on the Java servlet?
Solution
xhttp.open("GET", link+'?foo=bar&lorem=ipsum', true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send();
Answered By - Bibek Khadka