I'm trying to convert a HTML input element and the text within to a JSON object and then send it to a REST service.
How do I go about doing this using vanilla JS, not JQuery or any other libs. I have no clue what to put inside http.send() to send the text inside the input field.
HTML
<input id="answer" name="message" type="text" onclick="sendAnswer()" />
JS
function sendAnswer() {
http.open("POST", nextUrl, true);
http.setRequestHeader("Content-type", "application/json");
http.send(??);
}