<!DOCTYPEhtml> <html> <head> <title></title> <Metacharset="utf-8"/> <scripttype="text/javascript"> functionlogin(){ //第一步:创建ajax对象 varajax=newXMLHttpRequest(); //设置监听函数 ajax.onreadystatechange=function(){ if(ajax.readyState==4&&ajax.status==200){ varres=ajax.responseText; alert(res); } } //准备发送数据 ajax.open("get","./user.PHP?username=zhangsan&password=123456",true); //发送数据 ajax.send(null); } login(); login(); login(); </script> </head> <body> </body> </html>
user.PHP
<?PHP $username=$_GET['username']; $password=$_GET['password']; //处理数据 echo"注册成功"; ?>原文链接:https://www.f2er.com/ajax/162715.html