一个简单的ajax请求

//1、创建一个ajax对象 var xhr = new XMLHttpRequest(); //2、进行初始化 open('get|post','url地址') xhr.open('get','http://js.com/day6/ajax_get.php'); //3、绑定处理函数,我们写的代码,都在这里面 xhr.onreadystatechange = function () { alert(xhr.readyState) }; //4、开始干活 xhr.send();

猜你喜欢

转载自blog.csdn.net/liaohongying520/article/details/81626742