Answers for "using xmlhttprequest to get json"

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
0

XMLHttpRequest object

function reqListener () {
  console.log(this.responseText);
}

var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("GET", "http://www.example.org/example.txt");
oReq.send();
Posted by: Guest on July-21-2021

Code answers related to "using xmlhttprequest to get json"

Code answers related to "Javascript"

Browse Popular Code Answers by Language