PDA

View Full Version : XMLHttpRequest Question


tdesbarres
09-26-2007, 01:52 PM
I am using the XMLHttpRequest object to call a URL webproject/Skill.jsp

function loadXMLDoc(url) {
var req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
}

I was hoping to have the responseText come back but instead I am having the responseXML come back.

Here is the debug of the OL project

rocessReqChange: req.readyState 1
processReqChange: req.readyState 4
undefined
arg = «lz.XMLHttpRequest#6»
request.status 200
request.responseText:
request.responseXML: «lz.dataset#7| <localdata>&#xa;&#xa;&#xa;hello world&#xa;</localdata>»
request.getAllResponseaders: «lz.params#8| Date=Wed, 26 Sep 2007 21:45:08 GMT&Set-Cookie=JSESSIONID=299C6B2F6CCE7F8393D8BB595CEC1943 ; Path=/ResumeViewerWeb&Server=Apache-Coyote/1.1»

Here is what the .jsp file is doing:
<%@page language="java" contentType="text/plain; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<%
response.setContentType("text/plain");
out.print("hello world");
out.flush();
%>


any idea as to how I can get hello world to come back in the responseText attribute?

Thanks

onoke
08-24-2008, 11:50 PM
This issue have been unresolved even in v4.1.1.
And it is not on JIRA.
I mentioned this issue with testing JSON for OpenLaszlo by Oliver.
http://osteele.com/sources/openlaszlo/json/
I do not know which is better JSON or XML to handle on OpenLaszlo.

senshi
08-25-2008, 02:19 AM
Currently it's only possible to load xml-content with lz.XMLHttpRequest. I've just filed LPP-6877 (http://www.openlaszlo.org/jira/browse/LPP-6877), maybe we can use a new API which supports loading of plain-strings to enhance the lz.XMLHttpRequest class.