views:

77

answers:

4

By using javascript am trying to cal a webservice.That service return response as follows..

<envelope>
<date_time>
Test', callbackTest  Wednesday, March 31, 2010 2:28:55 AM
</date_time>
</envelope>

I am using firefox as browser to execute the application.Thats why after creating the object of XMLHttpRequest try to read as follows

_xmlDoc.responseXML.getElementsByTagName('date_time')[0].firstChild.nodeValue;

But it is showing output like undefined.please help me to solve this problem.What is actual problem ?

A: 

I am not sure you can do a getElementsByTagName() on a response object. Can you try it on the firebug command line first (since you said you are using firefox)?

pinaki
A: 

Does the response start with

<?xml version="1.0"?>

or somethig similar? That may cause problems. What do you get from .responseText?

Also, are you sure firstChild will get you the text node? have you tried nodeValue directly on _xmlDoc.responseXML.getElementsByTagName('date_time')[0]?

Victor
A: 

Store this output in one variable and try this,

 $var=service output,
 $date_time=$var->envelope->date_time;

now try getElementsByTagName on this $date_time variable.

MAS1
A: 

Something has changed with Firefox 3.6.2 Before I upgraded

myRequest.responseXML.getElementsByTagName('car')

was returning a list of nodes, with 3.6.2, nothing. In my case the response starts with

<xml version="1" encoding="UTF-8" standalone="yes">

Turns out I had â in my data. It was wrapped in CDATA so I thought I was safe. I'm sure it was fine prior to 3.6.2.

tschubring