[Javascript] Two Actions with one form

Matt Warden mwarden at gmail.com
Sun Mar 26 16:05:12 CST 2006


On 3/26/06, Del Wegener <del at delweg.com> wrote:
> Good Day;
>
> Upon submission of a form I would like two actions to happen:
> action="/cgi-bin/bizdb-aed.cgi"      to put the contents of the form in a
> database
> action=https://www.paypal.com/cgi-bin/webscr
>
> How do I accomplish this?
>
> I am guessing JavaScript -- that's why I tried this list.
>
> Thanks for any help.

Often you can make a return page from payment sites like paypal. These
will either post back all the content, or return it to you in the
query string. You might be able to do this with paypal. I would check
that first.

Failing that, you might have your cgi issue a post request to paypal.
This is not ideal, because paypal is probably expecting to be dealing
with the user agent of your customer, whereas in this case the user
agent would be your cgi script. This could cause problems.

Your other option is to submit to the form contents to your CGI with
something like XMLHTTP/AJAX, and then allow the form to post to
paypal. Something like:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post"
onsubmit="return postToCGI();">

function postToCGI()
{
   // do ajax to post to CGI with XMLHTTP/XmlHttpRequest
   return true;
}

--
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the Javascript mailing list