1var url = "get_data.php";
2var params = "lorem=ipsum&name=binny";
3http.open("POST", url, true);
4
5//Send the proper header information along with the request
6http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
7http.setRequestHeader("Content-length", params.length);
8http.setRequestHeader("Connection", "close");
9
10http.onreadystatechange = function() {//Call a function when the state changes.
11 if(http.readyState == 4 && http.status == 200) {
12 alert(http.responseText);
13 }
14}
15http.send(params);
16