I\'m trying to post data to a PHP page and check the response. Here is an example. What is wrong with this code?
index.html
I figured it out. I needed to set the request header.
xmlhttp.open("POST", "ajax.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("foo=" + foo + "&bar=" + bar);
source1
source2