E-junkie - We help you sell online
World Class Solution - Damon @ PayPal
Sell & promote your products Join affiliate programs offered by sellers Shop Community
  Google Custom Search

E-junkie Ecommerce Forums » E-junkie Discussions

Tag Cloud for this topic:

Thank You Page iframe JS



RichardoP
member
Posts: 4


Hi there,

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


#
POSTED ON: October 29, 2008 @ 03:29 GMT -7




Robin
member
Posts: 28


Can you please post the URL of the page where we can check this?


#
POSTED ON: October 29, 2008 @ 04:42 GMT -7




RichardoP
member
Posts: 4


Hi there,

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.


#
POSTED ON: October 29, 2008 @ 05:15 GMT -7
MODIFIED ON: October 29, 2008 @ 05:22 GMT -7




Tyson
E-Junkie Crew
Posts: 1486


I'm no JavaScript wizard personally, so I'm not sure what the issue could be with the JS you presented; however, the following is some functional iFrame JS that another Merchant had devised for their own use and posted on their blog for others' benefit, so perhaps you could use, adapt, or learn something from it:

---

<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).


#
POSTED ON: October 29, 2008 @ 13:48 GMT -7
MODIFIED ON: October 29, 2008 @ 13:51 GMT -7




RichardoP
member
Posts: 4


Tyson, thanks very much.

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>


#
POSTED ON: October 30, 2008 @ 02:32 GMT -7
MODIFIED ON: October 30, 2008 @ 02:33 GMT -7


You must be logged in to make a post. Please click here to login.

PayPal Certified Integration Google Checkout Certified Integrattion 30 Day Money Back Guarantee Slam the Online Scam
 Share this page!