"Grant Wagner" <gw*****@agricoreunited.com> wrote in message news:<Sa****************@news2.mts.net>...
"Fritz Bayer" <fr*********@web.de> wrote in message
news:a9**************************@posting.google.c om... Hello,
I'm looking for a javascript or html construct, which allows me to
pass some sales data to a remote cgi script. It should work for http
and https (ssl) connections.
The script or html construct should be in such a way that it does not
have any affect on the layout of the html page in which it is
embedded.
Fritz
<script type="text/javascript">
function sendData(valueOfA, valueOfB)
{
(new Image()).src =
'yourCgiScript.cgi' +
'?a=' + valueOfA +
'&b=' + valueOfB;
}
</script>
<form>
<input type="text" name="a" value="abc">
<input type="text" name="b" value="def">
<input type="button"
value="Send Data"
onclick="
sendData(
this.form.elements['a'].value,
this.form.elements['b'].value
);
">
Split across lines to avoid wordwrap.
Using (new Image()).src depends on the user agent supporting client-side
JavaScript and having it enabled, and supporting the ability to create a
new Image object and successfully set it's -src- property which results
in a GET to the server.
Getting data back to the client using this method, while possible, it
complicated and cumbersome. If you need the user agent to know the
results of the transaction, you should use the XML HTTP object <url:
http://jibbering.com/2002/4/httprequest.html />
Thanks for the code snippet. Yesterday I googled a bit more and found
the following two code snippets. What do you think of those?
<!-- Google Code for Purchase Conversion Page -->
<script language="javascript" type="text/javascript">
<!--
var google_conversion_id = 0;
var google_conversion_language = "en_GB";
var google_conversion_format = "1";
var google_conversion_color = "FFFFFF";
if ([VALUE]) {
var google_conversion_value = [VALUE];
}
var google_conversion_label = "Purchase";
//-->
</script>
<script language="javascript"
src="https://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<img height=1 width=1 border=0
src="https://www.googleadservices.com/pagead/conversion/0/?value=[VALUE]&label=Purchase&script=0">
</noscript>
<!-- Another script from a affiliate site -->
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
document.write("<SCR"+"IPT language=\"Javascript\"
type=\"text/javascript\"" +
"SRC=\"http://YourDomain/InstallationPath/ad.pl?md=rt&z=2&ca=7&typ=V&url=&ref="
+
escape(document.referrer) +
"\"></SCR"+"IPT>") ;
//-->
</script>
<NOSCRIPT><IMG WIDTH=1 HEIGHT=1
SRC="http://YourDomain/InstallationPath/ad.pl?md=rt&z=2&ca=7&typ=V"></noscript>