• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to POST without leaving the page?  RSS feed

 
Michael Cropper
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am wanting to click on a form button "preview" which will POST all of the data to a servlet that does its thing. I want to be able to do this without leaving the initial JSP page though since this would be much easier than passing all of the required parameters around and finally redirecting back to the original page with the relevant areas completed.

Is there any way to do this elegantly?

Thanks
Michael
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66149
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajax.
 
Michael Cropper
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanks, i'll see what I can find on that topic.

Very in-experienced with JavaScript, but im sure I will pick it up quick enough (for this task at least anyways!)

Thanks
Michael
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66149
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do yourself a favor and use one of the major JavaScript libraries to do your Ajax for you. Otherwise, it's a tar pit waiting for you to step into it...
 
Michael Cropper
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok will do, I'll get hold of one of them.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66149
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend jQuery (not surprisingly).
 
Michael Cropper
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it all sorted using this tutorial, http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/

Very helpful and it wasn't too difficult to pick up what was happening and customize it for what I needed :-)

Thanks
Michael

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!