How to get values from database in a popup window?

Edited 4 Years Ago by pritaeas: Moved.

This is your second post with the same question. To get help on this forum, you should stick to one post per question/topic. Next, post the code you are having trouble with so that the community members can take a look and provide you with guidance.

You need to provide more details... Type of database, what are you using for server-side scripting, etc..?

That's a good start, but not enough to get data out of a database. You'll need to be running some server-side scripting such as PHP, ASP.NET, Java, Classic ASP, etc... JavaScript is generally used for client-side scripting.

You can use JavaScript with Ajax, but you still need to call a resource on the server to pull from the database.

For example, you can refer to this demo that uses JavaScript, Ajax, PHP, and MySQL.
Ajax and PHP with MySQL

You use JavaScript to call Ajax which communicates back to the web server and the server-side PHP script pulls the data from the MySQL database, and returns the results back to the page.

This is just one method. There are various ways to accompish this.

The pop-up Window is a very small component to what you have to implement.

This could be a very length thread based on your responses....

Do you know how to pull information from you database and display it in a browser using Java as your back-end scripting language? If not, that is the first place to start.

Java and JavaScript is not the same thing. If you need help with Java, you should post questions in the JSP category.

Ok, unfortunately, I am not the best person to help you with regard to JSP.

Opening a popup using JavaScript is quite easy...here is an example...

<button onclick="javascript:return OpenPopup()">Click here</button>

<script type="text/javascript">
        function OpenPopup() {
            window.open("popUp.jsp", "PopUp", "scrollbars=no,resizable=no,width=400,height=280");
            return false;
        }
 </script>

Using the window.open method, you can send a value via a query string "popup.jsp?val=value"), or on the parent page, you can store a value in a session variable.

on the popup.jsp page, you retrieve this value and then query your database using JSP server side scripting.

Do you know how to pull data from a database using JSP? If not, that should be your focus at the moment.

This article has been dead for over six months. Start a new discussion instead.