File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes calling servlet from ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic
Author

calling servlet from ajax

Amit Da
Greenhorn

Joined: Mar 07, 2003
Posts: 16
I have a servlet A that I would call on a button click using AJAX. It checks certain things posted and if invalid comes back with error xml, which gets displayed on the same page.
In Valid case, I want to forward request and response objects to another servlet B, that would gather data from database and render the page using the response object.
This case is not working well for me. Here the callback JS function would not have anything to do in the page.
request.responseXML is null but request.responseText has the entire html document. I am wondering how in the callback JS I could take this document and replace the one in current window.document
Please help...any ideas about how to get this?
I would really dislike to have a response xml from servlet A in callback JS, that we would need to check and make another client to server (to servlet B) call to show second page...
any ideas???
thanks in advance,
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Amit,

I'm going to move this to our HTML/Javascript forum where you are likely to get a better answer.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Amit Da
Greenhorn

Joined: Mar 07, 2003
Posts: 16
please just delete it instead. I couldnt.
it's already posted there a post before
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Please don't cross-post your questions.
Doing so causes duplication of effort and confusion.

Once someone has noticed that the question they just spent time answering was already answered in another forum, they are likely to become annoyed enough with you that they will never want to answer another question of yours.

For more tips on asking questions here, see:
http://faq.javaranch.com/view?HowToAskQuestionsOnJavaRanch
 
wood burning stoves
 
subject: calling servlet from ajax
 
Similar Threads
Progress GIF Just Displays but No Animation
Export to xls file - Download file using AJAX
Handle Ajax call with Neutralization returning XML
Received xmlhttp result, want to allow user to download - how?
AJAX and Servlet question