get data from another page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robin

    get data from another page

    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

    -> a response will contain the data, and a script will fill the form

    ==>

    ID: A123456789
    NAME : dick
    PHONE: 123456
    ADDR : somewhere
  • KC Wong

    #2
    Re: get data from another page

    > now i have a text area, when user enter their ID (10 chars),[color=blue]
    > 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[/color]

    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.


    Comment

    Working...