"prototype.js" & responseXML

E

eschl

Doesn't "prototype.js" support the "responseXML" property of the
XMLHttpRequest object?

var url = "test.jsp";
var pars = "";
var myAjax =
new Ajax.Request(url,
{method: 'get', parameters: pars,
onComplete: mycallback }
);

"test.jsp"
<%
String sXml;
sXml = "<?xml version='1.0' encoding='utf-8' ?>";
sXml += "<response>aaa</response>";
%>
<%=sXml%>

"callbackfunction"
function mycallback(req)
{
alert(req.responseText); // ok!
if (req.responseXML == null)
alert("does not work!");
// req.responseXML seems to be null
}
 
R

Randy Webb

eschl said the following on 2/2/2006 7:53 AM:
Doesn't "prototype.js" support the "responseXML" property of the
XMLHttpRequest object?

Why don't you ask the people who wrote it?
 
D

David C. Wilson

I seem to remember something about responseText being populated on
Content-type: text/html responses and responseXML being populated on
text/xml responses.

You can either set the content type from the server (php has a "header"
function) or you can override it at the client. See details at the
link. Please post back here if it worked for you. Also where is the
Ajax object defined?

http://developer.mozilla.org/en/docs/AJAX:Getting_Started
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top