How to use POST method in XMLHttpRequest
This code is how to use POST method in XMLHttpRequest.
//config.xml
<access origin="*" subdomains="true"></access>
<tizen:privilege name="http://tizen.org/privilege/internet"/>
var xhttp;
xhttp=new XMLHttpRequest();
xhttp.open("POST", "http://httpbin.org/post");
xhttp.setRequestHeader("Content-Type", "application/text/plain");
xhttp.send("test");
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
document.getElementById("status").innerHTML = xhttp.status;
document.getElementById("statusText").innerHTML = xhttp.statusText;
document.getElementById("responseText").innerHTML = xhttp.responseText;
}
}