473,503 Members | 2,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using JavaScript to display database records

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
2 7556
"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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1713
by: Jack | last post by:
Hi, I need to build a asp page where it would serve as a data entry record page as well as display page for records saved. This page should also allow editing of records that has been saved. ...
0
1355
by: Richard Holliingsworth | last post by:
Hello: I'm building a report to display statistics on the entire database. I have successfully built a report that groups the entire db on one field and gives me a count of db records for the...
0
1792
by: Steve | last post by:
I'm using a ListView control in conjunction with a TreeView control to display SqlServer database records. Clicking a Node in the TreeView refreshes the ListView with the content of the associated...
1
1874
by: Santosh | last post by:
Dear all, i am giving selection to the user like when it select country from asp.net dropdownlist it will display all records in next dropdownlist related to it on asp.net...
1
2775
by: dheroan | last post by:
Hi there, I'm fairly new to using databases with VB .NET. I'm currently working on an application using a Microsoft Access database as a data source. I have created a form to display the fields...
4
1283
by: Mubs | last post by:
Hi all, I have a website set up using database, what i want to achieve is, i want a user to enter their number and then the database to display the records for only that number they...
3
3783
by: Coll | last post by:
I have a form that had been setup with a combo box. You'd select a value from the combo box and a query would open and display matching records. I now need to remove the combo box and set up a text...
2
1579
by: puneetmca | last post by:
hi i m new in php.... i want to generate a report of my database records having field names FirstName ,LastName and Age in student table and test database.....and i want to display these records in...
1
1449
by: reymon | last post by:
<?PHP //THIS IS MY DB CLASS CONNECTION class db { private $hostname; private $username; private $password; private $database; private $connect; private...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.