Is it posible to take http post response from some java servlet into some variable in java script let's say some string?
When I do http post request servlet returns some xml as a response and I would like to take that xml into some variable so that I can parse it with java script and then use that data.
Does any one has some ideas?
Thank.
Thank's for your quick answer.
This is exatcly what I'm trying to do.
I do http post from DHTML page on some URL where my servlet is. My servlet then does what it has to be done and
give back response witch is an String xmlstr containing XML with
PrintWriter out=response.getWriter();
out.println(xmlstr);
I would like to catch that xmlstr in my DHTML page in some
java script variable so that I can parse it in java script or that
I can generate a tree with nodes. I've tried it with loading response into layer but I couldn't get xml in it. Do you now of
a way to catch this xmlstr response into some java script variable on the same DHTML page for witch http post request
was done.
Code above will not pust xml string in a js variable..it will just dump all the data to the page.
you need to do something like this.
out.println("<script>");
out.println("var xmlStr = '"+xmlstr);
out.println("</script>");
Bookmarks