0
I would like to separate this data with ajax
, but I’m having a hard time with the nodes
:
<?xml version="1.0" encoding="ISO-8859-1"?>
<android_ecs.xml>
<node><IAAUTNUM>2089777</IAAUTNUM></node>
<node><IAAUTNUM>2089777</IAAUTNUM></node>
<node><IAESTORNO>ESTORNADA</IAESTORNO></node>
<node><IAENTNOME>ETD052 ENTIDADE</IAENTNOME></node>
<node><IAASSNOME>TESTES -TEF</IAASSNOME></node>
<node><IAASSPORT>TESTES -TEF</IAASSPORT></node>
<node><IACARTFMT>6298 6901 0001 6680</IACARTFMT></node>
<node><IAPARPRIM>2,33</IAPARPRIM></node>
<node><IAPARCOUT>0,00</IAPARCOUT></node>
<node><IAQTDPAR>1</IAQTDPAR></node>
<node><IAVALOPE>2,33</IAVALOPE></node>
<node><IACODSESAT></IACODSESAT></node>
<node><IANOMMES>JULHO/14</IANOMMES></node>
<node><IADATA>14/07/2014</IADATA></node>
<node><IAHORA>18:39:57</IAHORA></node>
</android_ecs.xml>
<script>
function dados(){
var ajax = false;
var xml = '';
if(window.XMLHttpRequest){
ajax = new XMLHttpRequest;
}else if(window.ActiveXObject){
ajax = new ActiveXObject("Microsoft.XMLHTTP");
}
//ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
if(ajax){
ajax.open("GET","http://remote.tecbiz.com.br:8080/tecbiz/tecbiz.php? a=725d5b&ecs=5054&sen=123456&aut=&acs=3",true);
ajax.onreadystatechange = function(){
if(ajax.readyState == 4){
if(ajax.status == 200){
xml = ajax.responseText;
android = xml.getElementsByTagName( "android_ecs.xml" )[0];
NUMAUT = android.childNodes[0].childNodes[1].nodeValue;
alert(NUMAUT);
}else{
alert('Erro!');
}
}
}
}
ajax.send(null);
}
</script>
Note: If I give one alert
in the responseText
it returns me the normal xml...the error that shows in the console is: Uncaught Typeerror: Undefined is not a Function
And if you use
responseXML
instead ofresponseText
, in the documentation says that to return an XML object, you have to useresponseXML
. At a glance here in the documentation– Fernando Leal
The problem is that when I use responseXML it returns me null...
– Rogers Corrêa
Which browser you are using?
– Fernando Leal
I’m using CHROME, I want to get what’s between the tags!
– Rogers Corrêa