Answers for "xmlhttprequest set json body"

2

how to add json data to xmlhttprequest

var xmlhttp = new XMLHttpRequest();   // new HttpRequest instance 
var theUrl = "/json-handler";
xmlhttp.open("POST", theUrl);
xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xmlhttp.send(JSON.stringify({ "email": "[email protected]", "response": { "name": "Tester" } }));
Posted by: Guest on November-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language