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. Advertisements

  2. Martin

    data64 Guest

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

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

  3. Martin

    Si Ballenger Guest

    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 :
    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.
     
    Disco Octopus, May 6, 2005
    #4
  5. Martin

    Martin Guest


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

    Si Ballenger Guest

    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

    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. Advertisements

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 (here). After that, you can post your question and our members will help you out.