This question already has answers here:
</div>
</div>
<div class="grid--cell mb0 mt4">
<a href="/questions/4112686/how-to-use-servlets-and-ajax" dir="ltr">How to use Servlets and Ajax?</a>
<span class="question-originals-answer-count">
(7 answers)
</span>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2016-05-07 07:01:45Z" class="relativetime">3 years ago</span>.</div>
</div>
</aside>
I have the following javaScript
function:
function loadSomething() {
var xhttp;
if (window.XMLHttpRequest) {
xhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET", "javaservlet.java", true);
xhttp.send();
}
and I want to get, lets say an int value from a Java Servlet
- "javaservlet". What code should I write in javaservlets doGet()
method in order to send a value, so I can get and use it in javaScript
? Thank you!
</div>