Hi all,

I have the following html/js code

Code:
<html>
<head><title>Ajax_Testing</title></head>
<body>
<form id="ajax_request" method="POST">
<dl>
<dt>UserName</dt>
<dd><input type="text" name="us" id="us"/></dd>
<dt>Password<dt>
<dd><input type="text" name="pw" id="pw"/></dd>
</dl>
<button type="submit" id="sb">Submit</button>
</form>
<script>
function createXMLHttpRequestObject()
{
  var Ajax;

  try
  {
    Ajax = new XMLHttpRequest();
  }
  catch (exception) 
  {
    try
    {
      Ajax = new ActiveXObject("Microsoft.XMLHttp");
    }
    catch(exception) {}
  }

  if(!Ajax)
  {
    alert("Error, your browser does not support Ajax");
  }
  else if (Ajax)
  {
    return Ajax;
  }

}


function openHttpRequest(session,rtype,url,async)
{
  session.open(rtype,url,async);
  session.onreadystatechange = function(){ ReadyStateHandler(session) }; 
  session.send("password=a_secret");
  return session;
}

function ReadyStateHandler(session)
{
  if(session.readyState == 4)
  {
	if(session.status==200)
	{
	var Responce = session.responseText;
	alert(Responce);
	}
  }
};


function sendRequest(Id)
{
  var sb_box = document.getElementById(Id);
  sb_box.onclick= function() {openHttpRequest(AjaxSession,"POST","ajax.php",true);return false}
}



var AjaxSession = createXMLHttpRequestObject();
sendRequest("sb")


</script>
</body>
</html>
and the following php code which goes along side

Code:
<?php

if(isset($_POST['password']))
{
$password = $_POST['password'];
}
else
{
$password = "no password";
}
echo $password;

?>
I have the following problem:

When the Ajax is requested the POST value of password does not seem to be given to the php code (atleast correctly) though when looking in the network parameters the password=a_secret is actually sent.

I think this is most likely something simple ... any ideas?

Thanks in advance to any replies.