|
-
Senior Member
sending a plain variable to recieve xml
hi
I'm currently loading an xml doc in using xml.load but I need to send variable torequest this document.
the xml.sendandload sends and loads XML data whereas the java servlet that will be called needs a simple variable
can anyone help me with this ?
-
Afternoon Chief,
using a CDATA section might possibly work... eg:
returnXML = new XML();
varXML = new XML("<![CDATA[variable=true]]>");
varXML.sendAndLoad(url,returnXML);
otherwise the servlet will have to be modified so that it can accept xml as well as variable input...
is the variable posted as a parameter to the servlet? if so then you might be able to append the url with the variable and use sendAndLoad with an empty xml doc.
give us a bell if it doesn't work.
cheers,
Andy
Last edited by Dowapdalilly; 08-21-2003 at 08:47 AM.
-
It will depend on how your Java Servlet expects to get it's variable(s), GET or POST.
If GET (query string) is OK, then it's easy, just add the info to the end of the URL, eg:
code:
var strName = "Tim";
var strURL = "/java/GetDetails.java";
var xmlDoc = new XML();
xmlDoc.ignoreWhite = true;
xmlDoc.onload = myOnLoadHandler;
xmlDoc.load( strURL + "?name=" + strName );
If it is expecting a POST then it might be a bit harder, I'm not sure how you could do that, Dowapdalilly's suggestion might work.
Hope this helps!
Tim Walters
Senior Developer
XML Evangelist
"XML isn't a language, it's a way of life!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|