By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

Using JavaScript to display database records

P: n/a
Hello,

I need some advice on how to handle the following scenario in
Javascript.

Imagine an HTML page that displays relational database records from an
address book application. Each record displayed is simply a summary of
information. In order to see more of the record details the user
clicks on the persons name (set up as a link) to display a popup window
with all of the remaining fields in the record. This allows the user
to display as many popup windows as they like.

This is a very simply application, but I am interested in learning how
to set it up so that the popup window receives the users name (or some
other ID) as a key and looks up the record in the database and
populates the popup window.

Can I do this in HTML alone? Javascript? Any help would be
appreciated.

Patrick

Jun 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Patrick" <pd******@aol.com> wrote in news:1149710138.732873.279500
@j55g2000cwa.googlegroups.com:
Can I do this in HTML alone? Javascript? Any help would be
appreciated.
You will need to get some back-end action involved in order to look up
the record in the database, so no, you cannot do it in HTML and
Javascript alone. Javascript cannot connect to a database (or a file on
the server (without AJAX)) as its run entirely on the client side (your
browser).

This is a very simply application, but I am interested in learning how
to set it up so that the popup window receives the users name (or some
other ID) as a key and looks up the record in the database and
populates the popup window.


Your popup URL would need to be a backend scripted page, ie. PHP or ASP
(called "more_info.php", for this example), and you would have to pass it
a key/id/reference via the URL. So, on the HTML page, the link to show
more records would have some javascript (to open the pop-up window) and
link to "more_info.php?id=12". Your "more_info.php" page would grab the
id number (12), hit the database for the additional info, and present it.
Of course there are a few other things to consider (will you mind if
people manipulate the id to get info about other users?, etc).
I hope I understood your question...

Jun 7 '06 #2

P: n/a

Good Man wrote:
"Patrick" <pd******@aol.com> wrote in news:1149710138.732873.279500
@j55g2000cwa.googlegroups.com:
Can I do this in HTML alone? Javascript? Any help would be
appreciated.


You will need to get some back-end action involved in order to look up
the record in the database, so no, you cannot do it in HTML and
Javascript alone. Javascript cannot connect to a database (or a file on
the server (without AJAX)) as its run entirely on the client side (your
browser).

This is a very simply application, but I am interested in learning how
to set it up so that the popup window receives the users name (or some
other ID) as a key and looks up the record in the database and
populates the popup window.


Your popup URL would need to be a backend scripted page, ie. PHP or ASP
(called "more_info.php", for this example), and you would have to pass it
a key/id/reference via the URL. So, on the HTML page, the link to show
more records would have some javascript (to open the pop-up window) and
link to "more_info.php?id=12". Your "more_info.php" page would grab the
id number (12), hit the database for the additional info, and present it.
Of course there are a few other things to consider (will you mind if
people manipulate the id to get info about other users?, etc).
I hope I understood your question...


Yes, you have understood the question well. I appreciate your
response.

The actual application for this functionality is an embedded system
that contains a very scaled down (home grown) webserver that has no way
to handle any fancy back-end processing such as PHP, ASP, etc. So
instead of using this dynamic approach I think I am going to have to
use static web pages, which would work okay.

Thanks again!

Patrick

Jun 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.