CGI: want no response from server

Discussion in 'Perl Misc' started by Richard Trahan, Jan 18, 2004.

  1. 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?
     
    Richard Trahan, Jan 18, 2004
    #1
    1. Advertising

  2. Richard Trahan

    gnari Guest

    Re: want no response from server

    "Richard Trahan" <> wrote in message
    news:jatOb.119013$...
    > 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
     
    gnari, Jan 18, 2004
    #2
    1. Advertising

  3. On Sun, 18 Jan 2004, Richard Trahan wrote:

    > 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.
     
    Alan J. Flavell, Jan 18, 2004
    #3
  4. Richard Trahan

    Tore Aursand Guest

    On Sun, 18 Jan 2004 10:25:19 +0000, Richard Trahan wrote:
    > I want to do something simple: nothing.
    > [...]


    In that case, it has _nothing_ to do with Perl.


    --
    Tore Aursand <>
    "First, God created idiots. That was just for practice. Then He created
    school boards." -- Mark Twain
     
    Tore Aursand, Jan 18, 2004
    #4
  5. Tore Aursand <> wrote:

    > On Sun, 18 Jan 2004 10:25:19 +0000, Richard Trahan wrote:
    >> I want to do something simple: nothing.
    >> [...]

    >
    > In that case, it has _nothing_ to do with Perl.


    But NaDa may be just the tool for it:

    http://www.bernardbelanger.com/computing/NaDa/
     
    David K. Wall, Jan 18, 2004
    #5
  6. > 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.
     
    Arvin Portlock, Jan 19, 2004
    #6
    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. Peter Bassett

    After response.redirect want screen back

    Peter Bassett, Aug 5, 2003, in forum: ASP General
    Replies:
    0
    Views:
    265
    Peter Bassett
    Aug 5, 2003
  2. Peter Bassett
    Replies:
    3
    Views:
    282
    Mark Schupp
    Aug 12, 2003
  3. Replies:
    4
    Views:
    181
    Ted Zlatanov
    Sep 13, 2006
  4. kath
    Replies:
    4
    Views:
    804
    J. Gleixner
    Apr 9, 2007
  5. pavi
    Replies:
    0
    Views:
    1,386
Loading...

Share This Page