Howto get data from Server

P

PVU

Hello,

I have an page that calls the function below.
What i want to do is that this function post data to the server (ASP) and
the server will response with 'OK'
My question is how can i send data clientside from Javascript to the server
? (navigate ? with url ?)
and check the returned data in the same function ?


function ShowData(TxtArt)
{
alert(TxtArt + ' : ' + parent.frames.Bottom.TxtUsrName.value + ' - ' +
parent.frames.Bottom.TxtRemarque.value); // testing purpose
// post the data to the server. ex .. myURL.asp?userID=1000&Art=ART1201
// fetch the data from the server. to verify if the 'OK' is recieved ->
the server will response with 'OK'
// if 'ok' -> i will update clientside an frame (ex. contents of
shoppingbasket)
}

Any idea's ?
Kind Regards,
Peter Verburgh
 
S

Stepan Mozyra

Hello, PVU!
You wrote on Thu, 1 Apr 2004 23:20:15 +0200:

P> I have an page that calls the function below.
P> What i want to do is that this function post data to the server (ASP)
P> and the server will response with 'OK'
P> My question is how can i send data clientside from Javascript to the
P> server ? (navigate ? with url ?)
P> and check the returned data in the same function ?


P> function ShowData(TxtArt)
P> {
P> alert(TxtArt + ' : ' + parent.frames.Bottom.TxtUsrName.value + ' -
P> ' +
P> parent.frames.Bottom.TxtRemarque.value); // testing purpose //
P> post the data to the server. ex .. myURL.asp?userID=1000&Art=ART1201
P> // fetch the data from the server. to verify if the 'OK' is recieved
P> ->
P> the server will response with 'OK'
P> // if 'ok' -> i will update clientside an frame (ex. contents of
P> shoppingbasket)
P> }

IMHO, there is no common way to implement such kind of operations (in
javascript, there may be something in VBScript, like Request/Response
objects, but i'm not sure).

I think the most reasonable way is to post data to server-side script, wich
can perform some action (validate etc) and depending on results respond to
frame proper html-page.
Something like:
- your page consist of two frames - first is a form, ssecond - is a basket;
- form submit with action="show.asp" target="secondframe";
- show.asp checks if TxtUsrName is real user name;
- if yes - response is a basket;
- if no - response is an error page, catalog, banner etc ;)

Good luck

// WBR, Mozyra Stepan
// SM17-UANIC
 
I

Ivo

PVU said:
What i want to do is that this function post data to the server (ASP) and
the server will response with 'OK'
My question is how can i send data clientside from Javascript to the server
? (navigate ? with url ?)
and check the returned data in the same function ?


function ShowData(TxtArt)
{
alert(TxtArt + ' : ' + parent.frames.Bottom.TxtUsrName.value + ' - ' +
parent.frames.Bottom.TxtRemarque.value); // testing purpose
// post the data to the server. ex .. myURL.asp?userID=1000&Art=ART1201
// fetch the data from the server. to verify if the 'OK' is recieved ->
the server will response with 'OK'
// if 'ok' -> i will update clientside an frame (ex. contents of
shoppingbasket)
}

Any idea's ?

For selected browsers only, the xml http request object, as mentioned in the
FAQ:
http://jibbering.com/faq/#FAQ4_38
http://www.galasoft-LB.ch/myjava/WebLoadFile/Demo/Demo.html
http://jibbering.com/2002/4/httprequest.html
in tango with some clever serverside processing.
HTH
Ivo
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top