Win a copy of Functional Reactive Programming this week in the Other Languages forum!
    Bookmark Topic Watch Topic
  • New Topic

calling servlet from ajax

 
Amit Da
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Amit,

I'm going to move this to our HTML/Javascript forum where you are likely to get a better answer.
 
Amit Da
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Report post to moderator
please just delete it instead. I couldnt.
it's already posted there a post before
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
    Bookmark Topic Watch Topic
  • New Topic