Re: CGI emailer that doesn't interrupt browsing
by Complex <complex_hwg(at)yahoo.com>
|
Date: |
Fri, 23 Feb 2001 12:21:57 -0800 (PST) |
To: |
Languages HWG <hwg-languages(at)hwg.org> |
In-Reply-To: |
yahoo |
|
todo: View
Thread,
Original
|
|
Ah, I found what I want. My page still didn't work, but I got the CGI
to work without reloading the page! :-)
Where the CGI changes the window location to a new page, or where it
outputs a success message in HTML or plain text,
instead have the CGI output the following:
print "Content-type: text/plain \n";
print "Status: 204 \n\n";
exit (0);
Yes, CGIs must return something to the browser. This "No Response"
message successfully ends the browser-CGI interaction without loading a
different page or anything.
FYI.
--- Complex <complex_hwg(at)yahoo.com> wrote:
> Hello,
>
> I am shopping for a simple CGI. I found one, and tried to modify it
> slightly, and ran into this problem...
>
> I want a small form to send its contents to the CGI. I want the CGI
> to
> email that information to me. Meanwhile, the form should use
> JavaScript
> to send the user to the next page. My problem is that even this
> simple
> CGI is trying to output a sucess page to the user. When I
> commented-out
> the lines responsible for the success page, an error-message page
> ("500
> Configuration error" or somesuch) appeared. Ugh!
>
> Previously, we'd used a Perl script that emailed the form results to
> us and then sent the user to the success page. The problem with that
> was when our ISP began having some sort of slow-down problems, the
> Perl
> script began behaving sporadically, and some users were blocked from
> accessing the success page. I'm not concerned, at the moment, with
> fixing the ISP problem; I'm concerned with removing the user's
> dependence on our CGI working.
>
> I want the user to be able to access the destination page whether
> the
> CGI succeeds or not. If the CGI fails, we won't get the information,
> but that's okay.
>
> All that said, here's my problem. I am playing with James Marshall's
> mailer.pl (http://www.jmarshall.com/easy/cgi), which is so
> well-commented that I can understand what it does (I don't actually
> program Perl). I commented out the part that writes the success page,
> and while the script continues to email the results to me, the
> browser
> displays an error message.
> Now I read in builder.com's Intro to CGI programming
> (http://www.builder.com/Programming/CGI/ss04a.html) that the CGI
> **must** return something to the browser! Is that true? To quote,
> they
> say,
>
> "Whenever a user invokes a program, the browser keeps the connection
> open, waiting for some kind of response. All of your CGI scripts need
> to send something back to the browser."
>
> URk! Is it true that my modified mailer.pl must return something to
> the browser? If so, how can I make it something other than an HTML
> page? I did succeed in outputting a JavaScript file meant to display
> an
> Alert, but :-) that resulted in the browser downloading an actual
> JavaScript file! Cool, IMO, but not what I wanted. I want the form to
> send the user to the desired page, whether or not the Perl script
> works, and I don't want the Perl script to further interrupt that
> progress.
>
> Many thanks for your help! This is eating up far too much time.
> complex
>
> =====
> Michael Greisman
> Webmaster
> Scanalytics, Inc.
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
=====
Michael Greisman
Webmaster
Scanalytics, Inc.
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA