E-Junkie Forum http://www.e-junkie.com/bb/ E-Junkie Forum RSS en-us Copyright 2013, 19.5 Degrees. All rights reserved. webmaster@e-junkie.com webmaster@e-junkie.com Thu, 30 Oct 2008 09:32:29 GMT Wed, 22 May 2013 08:32:57 GMT 681 E-JUNKIE 5 E-Junkie Forum http://www.e-junkie.com/bb/ http://www.e-junkie.com/ej/logo.gif 290 104 Post #5 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 Thu, 30 Oct 2008 09:32:29 GMT
I havent tried the JS that you posted but I have got my own JS (taken from various sources) to work. I'll post it below for anyone to use so that it might save some future headaches.

I make no comment about which JS is better, though yours does look leaner.

Richard

JS, Thank you page, Download link in iframe, variables from URL using JS, Transaction ID

----------------------------------

<h1>Thank you for your order</h1>

<script language="javascript" type="text/javascript">
function getParameter( parameterName ) {
var queryString = window.location.search.substring(1);
var parameters = queryString.split('&');
for(var i = 0; i < parameters.length; i++) {
if (parameters[i].indexOf(parameterName.toLowerCase())>=0) {
var parameterValue = parameters[i].split('=');
return parameterValue[1];
}
}
return '[not supplied]';
}
var FirstName = getParameter('first_name');
var LastName = getParameter('last_name');
var PayerEmail = getParameter('payer_email');
var PayerEmailEsc = unescape(PayerEmail);
var TxnID = getParameter('txn_id');
var Status = getParameter('payment_status');

</script>

<div>

<h2>Your Download Link</h2>

<iframe id="download_link" name="download_link" width="100%" height="50"> </iframe>

<script language="javascript" type="text/javascript">
var src = "https://www.e-junkie.com/ecom/rp.php?noredirect=true&txn_id=" + TxnID;
document.getElementById('download_link').src = src;
</script>

</div>]]>
E-junkie Discussions; RichardoP
Post #4 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 Wed, 29 Oct 2008 20:48:54 GMT
---

<script type="text/javascript">
<!--
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
document.write("<iframe src=http://www.e-junkie.com/ecom/rp.php?noredirect=true&txn_id="+gup('txn_id')+" style='width:100%;'></iframe>");
// -->
</script>

---

BTW, note that everything from document.write... to ...</iframe>"); there should actually be strung out on one long line together (apologies for the line-breakage here).]]>
E-junkie Discussions; E-junkieGuru
Post #3 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 Wed, 29 Oct 2008 12:15:54 GMT
thank you for the reply. I dont want to post the link, but I can post the relevant code below.

The script is currently working fine in Firefox but not in Safari. I haven't Tested in other browsers yet. I think the problem is that Safari is not writing "" around the src url for the Iframe.

---------------------------------

<h1>Thank you for your order</h1>
<div class="clear"></div>

<script language="javascript" type="text/javascript">
function getParameter( parameterName ) {
var queryString = window.location.search.substring(1);
var parameters = queryString.split('&');
for(var i = 0; i < parameters.length; i++) {
if (parameters[i].indexOf(parameterName.toLowerCase())>=0) {
var parameterValue = parameters[i].split('=');
return parameterValue[1];
}
}
return '[not supplied]';
}
var FirstName = getParameter('first_name');
var LastName = getParameter('last_name');
var PayerEmail = getParameter('payer_email');
var PayerEmailEsc = unescape(PayerEmail);
var TxnID = getParameter('txn_id');
var Status = getParameter('payment_status');


</script>



<div class="box-generic-editorial light">

<h2>Your Download Link</h2>

<script language="javascript" type="text/javascript">
document.write('<iframe src=https://www.e-junkie.com/ecom/rp.php?noredirect=true&txn_id=' + TxnID + ' width=100%' + ' height=50px' + ' /></iframe>')
</script>

</div>

--------------------------

Code after here writes the variables from the URL into the page and is irrelevant to the problem at hand.]]>
E-junkie Discussions; RichardoP
Post #2 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 Wed, 29 Oct 2008 11:42:01 GMT E-junkie Discussions; Robin Post #1 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 http://www.e-junkie.com/bb/topic/2954/pg/0#post8121 Wed, 29 Oct 2008 10:29:01 GMT
I am trying to fix the JS on my thank you page (hosted on my server) that brings in the thank you page for the download link, here is my current JS:

<script language="javascript" type="text/javascript">
document.write("'<iframe src=https://www.e-junkie.com/ecom/rp.php?noredirect=true&txn_id=' + 'TxnID' + 'width=100%' + 'height=50px'")
</script>

Which is not working. TxnID is the variable for the transaction ID takn from the URL. This functionality is 100% working as I am writing it to the page elsewhere.

It is the Syntax that writes my Iframe that is not working.

I appreciate this is a problem with my knowledge o JS, not a problem with E Junkie, but all the same I would really apprecite if anyone could wade in and show me the correct JS Syntax,

Thanks in advance

Richard]]>
E-junkie Discussions; RichardoP