Using JavaScript to display database records

Discussion in 'Javascript' started by Patrick, Jun 7, 2006.

  1. Patrick

    Patrick Guest

    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
     
    Patrick, Jun 7, 2006
    #1
    1. Advertising

  2. Patrick

    Patrick Guest

    Good Man wrote:
    > "Patrick" <> 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
     
    Patrick, Jun 8, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven Spits

    How to display 3 records of a database?

    Steven Spits, Jun 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    358
    Miguel Dias Moura
    Jun 5, 2004
  2. Shapper
    Replies:
    3
    Views:
    881
    Shapper
    Apr 21, 2005
  3. Luke Airig
    Replies:
    0
    Views:
    813
    Luke Airig
    Dec 31, 2003
  4. Dan

    Delete records or update records

    Dan, May 10, 2004, in forum: ASP General
    Replies:
    1
    Views:
    475
    Ray at
    May 10, 2004
  5. Replies:
    3
    Views:
    680
    Anthony Jones
    Nov 2, 2006
Loading...

Share This Page