dong5300 发表于 2018-12-20 10:09:49

php ajax 局部刷新

  




var xmlHttp;
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
xmlHttP = new XMLHttpRequest();
}
}
  function doGet(name){
createXMLHttpRequest();
if(name = document.getElementById('name').value){
xmlHttp.open("get","date.php?name="+name,true);
xmlHttp.onreadystatechange = byname;
    xmlHttp.send(null);
}
}
  function byname(){
if(xmlHttp.readyState == 1){
document.getElementById('span').innerHTML = "loading.....";
}
if(xmlHttp.readyState ==4){
if(xmlHttp.status ==200){
       document.getElementById('span').innerHTML = xmlHttp.responseText;
}
}
}

无标题文档

  







  date.php
  



页: [1]
查看完整版本: php ajax 局部刷新