DHTMLXAJAX problem with getting values from xml

Hi,

I’m having trouble with getting the values from xml.
The version of DHTMLX I use is: //v.3.0 build 110707

This is the code I use:
index.php:

... html code etc...
//script for DHTMLXAJAX etc.
<script type="text/javascript" src="/Parket/Globale_Javascripts/dhtmlxcommon.js"></script>
//script for DHTMLXCOMBO
<script type="text/javascript" src="/Parket/Globale_Javascripts/dhtmlxcombo.js"></script> 

function sendRequestGet() { 
   var url = './getVT.php?';
   var data = 'id=2';
   dhtmlxAjax.get(url + encodeURI(data), outputResponse);
}
function outputResponse(loader) {
   var xmldoc = loader.xmlDoc.responseXML;
   var xmldoc = loader.doSerialization();
   var address = xmldoc.getElementsByTagName('address').item(0).firstChild.data;
   //so I want to get the value of address (someaddress) of the xml-file
}
... some code to do the ajaxrequest (sendRequestGet)...
...end html etc...

getVT.php:

header("Content-type:text/xml");
ini_set('max_execution_time', 600);
print("<?xml version=\"1.0\"?>");
print("<address>");
print("someaddress");
print("</address>");
print("<city>");
print("somecity");
print("</city>");
print("<country>");
print("somecountry");
print("</country>");

Can someone help me with this please? Maybe I’m doing it wrong, but I need to get the values of the xml above into variables. There’s not much info available online, so I’m kind of stuck…

a) you xml is not valid, there must be only one top level tag

header("Content-type:text/xml"); ini_set('max_execution_time', 600); print("<?xml version=\"1.0\"?>"); print("<data>"); print("<address>"); print("someaddress"); print("</address>"); print("<city>"); print("somecity"); print("</city>"); print("<country>"); print("somecountry"); print("</country>"); print("</data>");

b) to ontain info you may use code as

function outputResponse(loader) { var address = loader.doXPath("//address")[0].firstChild.data; }

Super it works! Thank you very much! :smiley: