DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   Javascript help (http://www.daniweb.com/forums/thread95972.html)

Barefootsanders Nov 8th, 2007 8:41 am
Javascript help
 
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

ithelp Nov 8th, 2007 8:47 am
Re: Javascript help
 
May not be possible, use server side script like php

masijade Nov 8th, 2007 9:04 am
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.

Barefootsanders Nov 8th, 2007 9:14 am
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?

~s.o.s~ Nov 8th, 2007 11:00 am
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.

lookof2day Nov 8th, 2007 11:10 am
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


All times are GMT -4. The time now is 3:36 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC