Howto get data from Server

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

    Howto get data from Server

    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.B ottom.TxtUsrNam e.value + ' - ' +
    parent.frames.B ottom.TxtRemarq ue.value); // testing purpose
    // post the data to the server. ex .. myURL.asp?userI D=1000&Art=ART1 201
    // 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


  • Stepan Mozyra

    #2
    Re: Howto get data from Server

    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.B ottom.TxtUsrNam e.value + ' -
    P> ' +
    P> parent.frames.B ottom.TxtRemarq ue.value); // testing purpose //
    P> post the data to the server. ex .. myURL.asp?userI D=1000&Art=ART1 201
    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.as p" target="secondf rame";
    - 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


    Comment

    • Ivo

      #3
      Re: Howto get data from Server

      PVU said:[color=blue]
      > 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[/color]
      server[color=blue]
      > ? (navigate ? with url ?)
      > and check the returned data in the same function ?
      >
      >
      > function ShowData(TxtArt )
      > {
      > alert(TxtArt + ' : ' + parent.frames.B ottom.TxtUsrNam e.value + ' - ' +
      > parent.frames.B ottom.TxtRemarq ue.value); // testing purpose
      > // post the data to the server. ex .. myURL.asp?userI D=1000&Art=ART1 201
      > // 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 ?[/color]

      For selected browsers only, the xml http request object, as mentioned in the
      FAQ:



      in tango with some clever serverside processing.
      HTH
      Ivo


      Comment

      • PVU

        #4
        Re: Howto get data from Server

        tnx
        i'll check it out.
        Peter.

        "PVU" <petervu@skynet .be> schreef in bericht
        news:406c883f$0 $1368$ba620e4c@ news.skynet.be. ..[color=blue]
        > 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[/color]
        server[color=blue]
        > ? (navigate ? with url ?)
        > and check the returned data in the same function ?
        >
        >
        > function ShowData(TxtArt )
        > {
        > alert(TxtArt + ' : ' + parent.frames.B ottom.TxtUsrNam e.value + ' - ' +
        > parent.frames.B ottom.TxtRemarq ue.value); // testing purpose
        > // post the data to the server. ex .. myURL.asp?userI D=1000&Art=ART1 201
        > // 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
        >
        >[/color]


        Comment

        Working...