aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes AJAX request.responseXML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "AJAX request.responseXML" Watch "AJAX request.responseXML" New topic
Author

AJAX request.responseXML

pinky suresh
Greenhorn

Joined: Jul 21, 2008
Posts: 22
Hi,
I have a requirement where in on click of a button, I make asynchronous request to a servlet which in turn sends an XML as response, which is then used to update the page without any reload.

But in my AJAX call back method, when I do request.responseXML i am getting blank value.When i give an alert for request.responseText, I am able to see the complete xml content that is sent from servlet in response.

I have checked the correctness of xml file, by running the servlet alone.XML file gets loaded in IE properly without any errors.

I am not able to figure why request.responseXML is not giving me the XML response. Can any one please let me know the mistake/problem that i am facing?

I am using IE6 and Tomcat server with eclipse
Below is the code snippet of my AJAX call back function

CODE:
_________________________________________________________
function updatePage()
{
if(request.readyState == 4)
{
if(request.status == 200)
{
var xmlDoc = request.responseXML;
alert('after reading response:' + xmlDoc);
alert('responseText: ' + request.responseText);
alert('responseXML: ' + request.responseXML);
...
}
}

}
[/CODE]
_________________________________________________________


XML sent from servlet in simple form is as below:

<?xml version="1.0" encoding="UTF-8" ?>
<order>
<name>Nagasree</name>
<phone>12345</phone>
<address>street 20,California</address>
<noOfPizzas>2</noOfPizzas>
</order>

Please let me know what could be the problem.

[ August 22, 2008: Message edited by: pinky suresh ]

[ August 22, 2008: Message edited by: pinky suresh ]

[ August 25, 2008: Message edited by: pinky suresh ]

[ August 25, 2008: Message edited by: pinky suresh ]
[ August 25, 2008: Message edited by: pinky suresh ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60059
    
  65

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Benson Yeung
Greenhorn

Joined: Nov 30, 2008
Posts: 1
i have encountered similar problem in IE6, after hours of inspecting, here is the result I found.. hope this can help you

 
jQuery in Action, 2nd edition
 
subject: AJAX request.responseXML
 
Similar Threads
Problems with AJAX and XML
AJAX and Servlet question
Ajax responseXML problem
XmlHttpRequest.responseXML not populated
Ajax responseXML and IE - Small Issue