944,123 Members | Top Members by Rank

Ad:
Nov 8th, 2007
0

Javascript help

Expand Post »
Hey everyone,

I'm working on some javascript code. What i have now is a list box that contains certain elements and another list box, blank at the moment, next to it. I want, when someone clicks an element within the first list box, that in the background, a MySQL statement is run that will select everything pertaining to the selection. Like "SELECT * from TABLE_NAME WHERE coulumn = SELECTED ELEMENT". I was hoping someone could point me in the right direction as to how to perform this. Thanks!

-barefoot
Similar Threads
Reputation Points: 10
Solved Threads: 3
Junior Poster
Barefootsanders is offline Offline
165 posts
since Oct 2006
Nov 8th, 2007
0

Re: Javascript help

May not be possible, use server side script like php
Reputation Points: 769
Solved Threads: 128
Banned
ithelp is offline Offline
1,910 posts
since May 2006
Nov 8th, 2007
0

Re: Javascript help

AJAX maybe, to connect to a Servlet (or some other serverside program) that returns the results.

But, in any case, this is a JSP/Java forum, not JavaScript, please post this type of question in a JavaScript forum, next time. I have already asked the admins to move this one.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Nov 8th, 2007
0

Re: Javascript help

Ooops. Sorry. I clicked the wrong forum.

Thanks for the responses though. Would it be possible to run a PHP script through a javascript call?
Reputation Points: 10
Solved Threads: 3
Junior Poster
Barefootsanders is offline Offline
165 posts
since Oct 2006
Nov 8th, 2007
0

Re: Javascript help

This example does exactly what you want. Also try to read a few links from this page if you plan on some serious stuff with possibly a good book by your side.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006
Nov 8th, 2007
0

Re: Javascript help

Well you require a combination of JSP and JavaScript. I don't have the code right now but will work on it and provide it to you. The logic is:

1) Retrieve a java.util.List of Objects from database in a user session.

2)Iterate over the java.util.List and populate the objects in HTML list.

3)Use Java Script and use onClick/onChange method of list to call another Servlet/JSP.

4) Use <jsp:include> to embed the second JSP with an html list in the first JSP.

5) Write the logic for populating the html list in the second JSP with the elements of the first one
Reputation Points: 16
Solved Threads: 11
Junior Poster in Training
lookof2day is offline Offline
83 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Enter key does not work in window.showModalDialog
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Images, thumbnails, and iFrames





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC