标签:ajax
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8" /> <script type="text/javascript"> function login(){ //第一步:创建ajax对象 var ajax = new XMLHttpRequest(); //设置监听函数 ajax.onreadystatechange = function(){ if (ajax.readyState==4 && ajax.status == 200){ var res = 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 "注册成功"; ?>
本文出自 “IT5808” 博客,请务必保留此出处http://it5808.blog.51cto.com/10842703/1713239
标签:ajax
原文地址:http://it5808.blog.51cto.com/10842703/1713239