Submit without refreshing page?

M

Martin

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

data64

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
 
S

Si Ballenger

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
 
D

Disco Octopus

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

Si Ballenger

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
 
A

Andy Dingley

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

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

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top