0
{ 
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
 var url="http://www.galatasaray.org/_ajax/dinamik_fikstur.php?no=6";
 xmlHttp.onreadystatechange=stateChanged;
 xmlHttp.open('GET',url,true);
 xmlHttp.setRequestHeader('Content-type', "text/xml");
 xmlHttp.send(null);
 }
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{   
 xmlDoc=xmlHttp.responseXML;
 alert(xmlHttp.responseXML);
 document.getElementById("myDiv").innerHTML=xmlHttp.responseXML;
 document.getElementById("takim2").innerHTML=
 xmlDoc.getElementsByTagName("owner")[0].childNodes[0].nodeValue;
 document.getElementById("takim1").innerHTML=
 xmlDoc.getElementsByTagName("guest")[0].childNodes[0].nodeValue;
 }
} 
function GetXmlHttpObject()
 { 
 var objXMLHttp=null;
 if (window.XMLHttpRequest)
  {
  objXMLHttp=new XMLHttpRequest();
  }
 else if (window.ActiveXObject)
  {
  objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 return objXMLHttp;
 }

我是 ajax 编程的新手,我有一个问题。responseXML 返回空值。我该如何解决这个问题?我尝试了 responseText 并返回空。我搜索了很多资源但我找不到解决方案

4

0 回答 0