The ajax code:
Code:
var xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
window.alert("Your browser does not support ajax.\n Please use latest version of your browser.");
return;
}
if (xmlHttp.overrideMimeType)
xmlHttp.overrideMimeType("text/xml");
xmlHttp.open("POST", "signup_server.php", true);
xmlHttp.setRequestHeader("Content-Type",
"application/x-www-form- urlencoded; charset=UTF-8");
var str = "name=n";
xmlHttp.send(str);
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
window.status = xmlHttp.responseText;
}
else
window.alert("Error " + xmlHttp.status + ": " + xmlHttp.statusText);
}
}
Server side code:
Code:
<?php
if (isset($_POST["name"]))
echo $_POST["name"];
else
echo "Name not found.";
?>
After execution, the window.status contains "Name not found." string. Why the server cannot get the name=n? I'm using IIS in Windows XP SP2 and PHP version 5.2.5.
Thanks in advance.