Get data from database without refreshing the page






3.56/5 (9 votes)
Nov 13, 2002

124212

1855
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.