Published
- 1 min read
how to add json data to xmlhttprequest
The solution for this is noted below
how to add json data to xmlhttprequest
Solution
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": "hello@user.com", "response": { "name": "Tester" } }));
Try other methods by searching on the site. That is if this doesn’t work