I'm having a terribly frustrating time getting this to work. I want to dynamically load/update an amazon mp3 widget.
Amazon provides two scripts to include in the intended target location of the widget (https://widgets.amazon.com/Widget-Source/). I want to replace the widget with a new widget on a click event.
I have tried inserting the scripts as strings into a DOM element using jQuery's html() and appendTo(). I know that the injection works to some degree because I get the test alert that I added to the end of it.
I have tried using createElement() which is recommended here: Can't append <script> element. Again, the alert() fires but no widget appears.
I found someone dealing with the same issue here: Is it possible to programmatically add Amazon MP3 widgets. I'm hopeful since it has an accepted answer but I still don't understand how it helps to introduce the new widget into the DOM.
<script type='text/javascript'>
var amzn_wdgt={widget:'MP3Clips'};
amzn_wdgt.tag='widgetsamazon-20';
amzn_wdgt.widgetType='ASINList';
amzn_wdgt.ASIN='B0011Z0YR2,B00137W4P8,B0013G0PG4,B001AU8ZLK,B001AUCJZ8,B001AUEMDK,B001AU8YB6,B001AU8YBQ,B001AU8YCK,B001AUCK2U,B001AUEMFS,B001AUCK52,B001AU6XE6,B001AUEMH6';
amzn_wdgt.title='What I\'ve been listening to lately...';
amzn_wdgt.width='250';
amzn_wdgt.height='250';
amzn_wdgt.shuffleTracks='True';
amzn_wdgt.marketPlace='US';
</script>
<script type='text/javascript' src='http://wms.assoc-amazon.com/20070822/US/js/swfobject_1_5.js'>
Thanks.