JSFiddle - React, Tailwind, and code Playground
by igalst
HTML
<script src="http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js"></script>
JavaScript
var postData = { "text": "some text","array": [1, 2, "three"], "object": {"par1": "another text", "par2": [3, 2, "one"], "par3": {}, "par4": false}};
console.log("postData =", postData);
var http = new XMLHttpRequest();
var url = "/echo/json/";
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-Type", 'application/x-www-form-urlencoded; charset=UTF-8');
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send("json=" + JSON.stringify(postData));