I'm trying to generate an Amazon ad that should look like this.
<script type="text/javascript"><!--
amazon_ad_tag = "xxxxxxx"; amazon_ad_width = "160"; amazon_ad_height = "600";//--></script>
<script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"></script>
Below are parts of my script that should achieve that. The script BTW is for rotating more types of affiliate ads.
First is a global variable with all the Amazon ad options...
ad_code = 'amazon_ad_tag = "xxxxxxx"; amazon_ad_width = "160"; amazon_ad_height = "600";';
Next I'm loading the ad_code
in a "ad_slot" div. The contents of ad_code
should appear between <script>
tags.
$('.amazon_ad').html('<scr'+'ipt type=\"text/javascript\"><!--' + ad_code + '//--></scr'+'ipt><scr'+'ipt src=\"' + window.location.protocol +'//www.assoc-amazon.com/s/ads.js\" type=\"text/javascr'+'ipt\"></scr'+'ipt>');
The result should be the first code I posted and display an Amazon banner, instead my browser goes to http://www.assoc-amazon.com/s/ads.js, the script that should load.
Does anyone know what I'm doing wrong?