Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Get data from database without refreshing the page

0.00/5 (No votes)
13 Nov 2002 1  
works in all browsers

Introduction

The flow of the application is interrupted by page reloads whenever the client communicates with the server. Here is the simple solution to this problem, you can get data from a database without refreshing page. I tested this application with all browsers and it worked fine.

Zip file contains:

  • Default.asp (HTML interface)
  • getAllMembers.asp (gets all data from database)
  • db.mdb (User information database)

Following function calls another page to get information (data) from the database. Pass "First name" and "Last Name" to getAllMembers.asp page.

function getAllMembers()
{
    var FirstName;
    var LastName;
    var memberName;
    FirstName = document.frmUsers.txtFirstName.value;
    LastName =  document.frmUsers.txtLastName.value;
    memberName = "firstName="+ FirstName +"&lastName="+ LastName;
    window.open("getAllMembers.asp?"+ memberName,"lstNames",
        "width=200,height=100,left=200,top=300")
}

In getAllMembers.asp page, use window.opener.document.frm. This method is used to pass all values to the list box on main page.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here