Submit without refreshing page?

Discussion in 'HTML' started by Martin, May 5, 2005.

  1. Martin

    Martin Guest

    I have a situation where I want to allow the user to click a button on
    a page (in a table cell, if it makes any difference) that will
    activate a server-side script. There is no need to have the user's
    page refresh or update.

    I'm currently using the following in the table cell but after calling
    my script on the server, the page is resent. I'd like to avoid that.

    <FORM method='post'><INPUT type='submit' value='Release Lane'
    name='RELEASE' </FORM>


    Thanks for any suggestions.
     
    Martin, May 5, 2005
    #1
    1. Advertising

  2. Martin

    data64 Guest

    Martin <> wrote in
    news:p:

    > I have a situation where I want to allow the user to click a button on
    > a page (in a table cell, if it makes any difference) that will
    > activate a server-side script. There is no need to have the user's
    > page refresh or update.
    >


    Maybe use an IFrame ? Google maps does something like this using javascript.

    data64
     
    data64, May 6, 2005
    #2
    1. Advertising

  3. Martin

    Si Ballenger Guest

    On Thu, 05 May 2005 13:47:51 -0700, Martin
    <> wrote:

    >I have a situation where I want to allow the user to click a button on
    >a page (in a table cell, if it makes any difference) that will
    >activate a server-side script. There is no need to have the user's
    >page refresh or update.
    >
    >I'm currently using the following in the table cell but after calling
    >my script on the server, the page is resent. I'd like to avoid that.
    >
    ><FORM method='post'><INPUT type='submit' value='Release Lane'
    >name='RELEASE' </FORM>
    >
    >
    >Thanks for any suggestions.


    Have your script output the status: 204 code followed by two
    blank lines. This will tell the brouser to not refresh the page.
    I use it on my webcam pan tilt page below.

    http://www.geocities.com/zoomkat/ezservo1.htm
     
    Si Ballenger, May 6, 2005
    #3
  4. Martin wrote :
    > I have a situation where I want to allow the user to click a button on
    > a page (in a table cell, if it makes any difference) that will
    > activate a server-side script. There is no need to have the user's
    > page refresh or update.
    >
    > I'm currently using the following in the table cell but after calling
    > my script on the server, the page is resent. I'd like to avoid that.
    >
    > <FORM method='post'><INPUT type='submit' value='Release Lane'
    > name='RELEASE' </FORM>
    >
    >
    > Thanks for any suggestions.


    we used to do something like this but we send over data. using
    javascript...

    * onClick of a button (Not a submit button).
    1. create a new window/popup
    2. send the new window the input data from the <from> on your page.

    * onLoad of your new window.
    1. submit the <form> that was sent over by the other page.
    2. close the window.

    --
    a beef jerky web site : http://www.choicebeefjerky.com.au
    not a beef jerky web site : http://mycoolwheels.com/vote.cmks
    if the oil light is on, dont think it will just go away
     
    Disco Octopus, May 6, 2005
    #4
  5. Martin

    Martin Guest

    On Fri, 06 May 2005 00:02:13 GMT, shb*NO*SPAM*@comporium.net (Si
    Ballenger) wrote:

    >On Thu, 05 May 2005 13:47:51 -0700, Martin
    ><> wrote:
    >
    >>I have a situation where I want to allow the user to click a button on
    >>a page (in a table cell, if it makes any difference) that will
    >>activate a server-side script. There is no need to have the user's
    >>page refresh or update.
    >>
    >>I'm currently using the following in the table cell but after calling
    >>my script on the server, the page is resent. I'd like to avoid that.
    >>
    >><FORM method='post'><INPUT type='submit' value='Release Lane'
    >>name='RELEASE' </FORM>
    >>
    >>
    >>Thanks for any suggestions.

    >
    >Have your script output the status: 204 code followed by two
    >blank lines. This will tell the brouser to not refresh the page.
    >I use it on my webcam pan tilt page below.
    >
    >http://www.geocities.com/zoomkat/ezservo1.htm



    Thanks - that worked perfectly (how did you ever figure that out?).
     
    Martin, May 6, 2005
    #5
  6. Martin

    Si Ballenger Guest

    On Fri, 06 May 2005 07:34:53 -0700, Martin
    <> wrote:

    >On Fri, 06 May 2005 00:02:13 GMT, shb*NO*SPAM*@comporium.net (Si
    >Ballenger) wrote:
    >
    >>On Thu, 05 May 2005 13:47:51 -0700, Martin
    >><> wrote:
    >>
    >>>I have a situation where I want to allow the user to click a button on
    >>>a page (in a table cell, if it makes any difference) that will
    >>>activate a server-side script. There is no need to have the user's
    >>>page refresh or update.
    >>>
    >>>I'm currently using the following in the table cell but after calling
    >>>my script on the server, the page is resent. I'd like to avoid that.
    >>>
    >>><FORM method='post'><INPUT type='submit' value='Release Lane'
    >>>name='RELEASE' </FORM>
    >>>
    >>>
    >>>Thanks for any suggestions.

    >>
    >>Have your script output the status: 204 code followed by two
    >>blank lines. This will tell the brouser to not refresh the page.
    >>I use it on my webcam pan tilt page below.
    >>
    >>http://www.geocities.com/zoomkat/ezservo1.htm

    >
    >
    >Thanks - that worked perfectly (how did you ever figure that out?).


    It is just a little known part of the HTTP specs that I find very
    useful for controlling things via the web. Most html types freak
    out on this saying "but they will just keep clicking the button!"
    With video feedback or a knowledge of what is going on, that
    isn't an issue. Iframes will work too, but they screw up the
    brouser "back" button. Below is a page I've come up with that
    uses the status: 204 and an iframe to prevent the java script
    image pull setup from being disturbed when the cam switch buttons
    are pressed.

    http://www.geocities.com/zoomkat/wc20000sw.htm
     
    Si Ballenger, May 6, 2005
    #6
  7. Martin

    Andy Dingley Guest

    On Fri, 06 May 2005 07:34:53 -0700, Martin <>
    wrote:


    >>Have your script output the status: 204 code followed by two
    >>blank lines. This will tell the brouser to not refresh the page.


    >Thanks - that worked perfectly (how did you ever figure that out?).


    It's in the HTTP spec - originally intended as a "no-op" code for use
    with null clicks for server-side imagemaps.


    On a related topic, here's a drawback with the Google Web Accelerator
    http://37signals.com/svn/archives2/...ot_so_fast_an_alert_for_web_app_designers.php

    If you'd ever wondered about the necessity for that "idempotent"
    business and the need to be careful with GET vs. POST, here's a hint as
    to what happens when you build your site in a non-robust manner and a
    great clodhopping thing like this "accelerator" comes along..
     
    Andy Dingley, May 8, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Milsnips
    Replies:
    1
    Views:
    569
    =?Utf-8?B?Z3VpbGxhdW1lIFN0RXRpZW5uZSBGUg==?=
    May 16, 2005
  2. Replies:
    2
    Views:
    6,241
  3. Harlan Messinger

    Self-refreshing and non-self-refreshing controls

    Harlan Messinger, Aug 4, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    460
    =?Utf-8?B?Y2xpY2tvbg==?=
    Aug 4, 2006
  4. Harlan Messinger

    Self-refreshing and non-self-refreshing controls

    Harlan Messinger, Aug 3, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    189
    Harlan Messinger
    Aug 3, 2006
  5. Replies:
    2
    Views:
    361
Loading...

Share This Page