CGI: want no response from server

R

Richard Trahan

I want to do something simple: nothing.

I have a form. When the user clicks Submit, I want the script to be
invoked in the usual manner, but I want no change at all in the client
page (the script does some background task on the server). I know I can
redirect to the referer, but that causes a scroll to top, which is
annoying for a large page. Even if I coded "#" links all over the
place to avoid the scroll, there would still be a long wait for
users with slow modems.

If I don't write anything to STDOUT from the script, I get error
messages from the server. I'm not sure what's happening here.
Can someone educate me?
 
G

gnari

Richard Trahan said:
I want to do something simple: nothing.

I have a form. When the user clicks Submit, I want the script to be
invoked in the usual manner, but I want no change at all in the client
page (the script does some background task on the server). I know I can
redirect to the referer, but that causes a scroll to top, which is
annoying for a large page. Even if I coded "#" links all over the
place to avoid the scroll, there would still be a long wait for
users with slow modems.

If I don't write anything to STDOUT from the script, I get error
messages from the server. I'm not sure what's happening here.
Can someone educate me?

the www or cgi groups are the correct place for this kind of
questions.

I do not have your answer, but if the referer page is also dynamic,
you might want to try to play with cache-control, date and
other HTTP headers, to try to convince the browser not to
reload.

gnari
 
A

Alan J. Flavell

I want to do something simple: nothing.

Not quite as simple as it looks; at least, it took browser
implementers a considerable time to get it right per the
specification, but AFAIK they're OK now.
I have a form. When the user clicks Submit, I want the script to be
invoked in the usual manner, but I want no change at all in the client
page (the script does some background task on the server).

Not a Perl issue, and you ought to raise this kind of question on
a group where WWW CGI questions are on-topic, just as it hints in
perlfaq9. But in brief the answer is Status: 204 No response
If I don't write anything to STDOUT from the script, I get error
messages from the server.

Correct. All CGI scripts must return some kind of appropriate
response to STDOUT, or else the server will return an error report to
the client (typically "premature end of script headers").
I'm not sure what's happening here.

perlfaq9 has pointers to the CGI specification, tutorials, and an
appropriate Usenet group. HTH.
 
A

Arvin Portlock

But in brief the answer is Status: 204 No response


A good answer. Another technique people use is an invisible frame.
Your HTML document will be a frameset with your form in a frame
that takes up 100% of the screen. But your form will target its
output to a second, invisible 0% frame that people never see:

<form action="some_script.pl" target="my_secret_frame">

But this solution carries with it all the overhead and
problems of frames in general for little benefit.
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top