HighDots Forums  

get data from another page

Javascript JavaScript language (comp.lang.javascript)


Discuss get data from another page in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Robin
 
Posts: n/a

Default get data from another page - 09-22-2003 , 04:00 AM






now i have a text area, when user enter their ID (10 chars),
a script will use the id to use this ID to get the user data,
and fill the form automatically. how can i use javascript to get data
from anther page (JSP generated). as follow

STEP 1: user enter id,

ID: A123456789
NAME : _________
PHONE: _________
ADDR : _________

-> after enter the id (without submit)
-> a javascript will send a request to
http://localhost/getuser?id=A123456789
-> a response will contain the data, and a script will fill the form

==>

ID: A123456789
NAME : dick
PHONE: 123456
ADDR : somewhere

Reply With Quote
  #2  
Old   
KC Wong
 
Posts: n/a

Default Re: get data from another page - 09-22-2003 , 04:16 AM






Quote:
now i have a text area, when user enter their ID (10 chars),
a script will use the id to use this ID to get the user data,
and fill the form automatically. how can i use javascript to get data
from anther page (JSP generated). as follow

STEP 1: user enter id,

ID: A123456789
NAME : _________
PHONE: _________
ADDR : _________

-> after enter the id (without submit)
-> a javascript will send a request to
http://localhost/getuser?id=A123456789
-> a response will contain the data, and a script will fill the form

==

ID: A123456789
NAME : dick
PHONE: 123456
ADDR : somewhere
This can be done like this:

Your Page (ID field's onchange event) --submit--> jsp for data --submit-->
Your Page (again)

Your page should be a JSP, which do nothing on a GET request. The page
contains your HTML form, where the ID input field's onchange event will call
JavaScript to submit your form to the JSP page. Make a way so that JSP page
can redirect back to your page (e.g. pass URL along with ID), and in your
page when a POST request is received, retrieve posted data and fill them
into the form (via JavaScript).


KC.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.