重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

ajax通用代码的示例分析

这篇文章主要介绍ajax通用代码的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

创新互联是一家专业提供忻府企业网站建设,专注与成都网站设计、成都做网站HTML5、小程序制作等业务。10年已为忻府众多企业、政府机构等服务。创新互联专业网站制作公司优惠进行中。

具体如下:




var xmlhttp
function loadXMLDoc(url)
{
 // code for Mozilla, etc.
 if (window.XMLHttpRequest)
 {
 xmlhttp=new XMLHttpRequest()
 xmlhttp.onreadystatechange=state_Change
 xmlhttp.open("GET",url,true)
 xmlhttp.send(null)
 }
 // code for IE
 else if (window.ActiveXObject)
 {
 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  if (xmlhttp)
  {
  xmlhttp.onreadystatechange=state_Change
  xmlhttp.open("GET",url,true)
  xmlhttp.send()
  }
 }
}
function state_Change()
{
 // if xmlhttp shows "loaded"
 if (xmlhttp.readyState==4)
 {
 // if "OK"
 if (xmlhttp.status==200)
 {
 document.getElementById('T1').innerHTML=xmlhttp.responseText
 }
 else
 {
 alert("Problem retrieving data:" + xmlhttp.statusText)
 }
 }
}



Click

以上是“ajax通用代码的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


文章标题:ajax通用代码的示例分析
URL网址:http://cqcxhl.com/article/ghpids.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP