This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javascript function calling a servlet

 
Stuart Rogers
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings all,

I've crafted a jsp at http://www.purplelizardgallerycom/show_project_directories.jsp

which contains an <jsp:include "foobar"/> to build the select box,
followed by a button to call a javascript function , followed by an
<div id="clistgoeshere">

Clicking the button triggers the function, which grabs the value picked in the select box and displays it in <div id="clistgoeshere">.

So far so good.

I have a servlet "bohica" that returns some content.

How can I modify the javascript function to call the servlet (something like bohica( projpicked) ) AND have the resulting content displayed in <div id="clistgoeshere"> ?

TIA,

Stuart
 
Satish Chilukuri
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you need is an AJAX call.
 
Stuart Rogers
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By Jove you are correct! Yes this Ajax stuff looks like just the secret sauce I need.

Thanks,

Stuart
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do yourself a favor and, after you familiarize yourself with how Ajax works, adopt a library such as jQuery to handle your Ajax calls for you.

Your hair will thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic