日期:2014-05-16 浏览次数:20418 次
function Send_message(rUsername,rPassword){
var xmlhttp;
if(rUsername == 0 || rPassword == 0){
alert("error");
return;
}
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
alert("status:"+xmlhttp.status+"readystate:"+xmlhttp.readyState);
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("result").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("get","php/index.php",false);
xmlhttp.send();
}
<span id="result">haha</span>
<form action="">
<div class = "loginPanelControlsGroup">
<input class = "loginControls" type="text" id="loginUsername" name = "loginUsername">
</div>
<div class = "loginPanelControlsGroup">
<input class = "loginControls" type="text" name="loginPassword" id="loginPassword">
</div>
<div class = "loginControlsGroup">
<button class="panelBTN" id="loginPanelBTN" onclick = "Send_message(loginUsername.value,loginPassword.value)" ><span class = "panelBTNText">登陆</span></button>
</div>
<?php
// $username = $_POST["username"];
// $password = $_POST["password"];
$result = "dsafsdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
echo $result;
?>