Crazy knowledge base

ajax 简单异步提交实例

countload(“http://example.com/Noname13.php?input=11111&username=aaa”);

function countload(resource) {
 if (window.XMLHttpRequest)
 {
  xmlObj = new XMLHttpRequest();
 }else if (window.ActiveXObject){
  xmlObj = new ActiveXObject(“Microsoft.XMLHTTP”);
 }else{
  return;
 }
 xmlObj.onreadystatechange = handleResponse;
 xmlObj.open(“GET”,resource,true);
 xmlObj.send(“”);
}

function handleResponse()
{
 if (xmlObj.readyState == 4){
 //xmlObj loaded
  if (xmlObj.status == 200)
  {
   var data = xmlObj.responseText;
   var obj = document.getElementById(“data”);
   obj.innerHTML = data;
  }
 }
}

ajax 简单异步提交实例

ajax 简单异步提交实例”上有 1 条回复;

评论已关闭。

滚动到顶部