I am building a tumblr theme and have an ajax call that gets a video player, the video player code is returned and I log it out to the console (see #1). I write out the returned html to an element (#2) and then write out the contents of that element (#3) and the tags get parsed out.
Can anyone help me understand why the script tags are getting stripped and how I would get the script to run please?
console.log(data.posts[0]["video-player"]); //#1
$("#DOMWindow .post-inner .video-container").html(data.posts[0]["video-player"]); //#2
$("#DOMWindow .post-inner .video-container").html(); //#3
Below is the output in the console for data.posts[0]["video-player"]
<span id="video_player_21019988413">[<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Flash 10</a> is required to watch video.]</span><script type="text/javascript">renderVideo("video_player_21019988413",'http://penguinenglishlibrary.tumblr.com/video_file/21019988413/tumblr_m2f2kbQFzu1rsq78z',400,225,'poster=http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_m2f2kbQFzu1rsq78z_r1_frame1.jpg,http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_m2f2kbQFzu1rsq78z_r1_frame2.jpg,http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_m2f2kbQFzu1rsq78z_r1_frame3.jpg,http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_m2f2kbQFzu1rsq78z_r1_frame4.jpg,http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_m2f2kbQFzu1rsq78z_r1_frame5.jpg')</script>
Below is the output from the .html() call with the elements stripped #3
<span id="video_player_21019988413">[<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Flash 10</a> is required to watch video.]</span>"
Below is the full ajax call that should be inserting the script tags into the page but doesn't:
$.ajax({
url: 'http://penguinenglishlibrary.tumblr.com/api/read/json?id=' + audioID,
dataType: 'jsonp',
timeout: 50000,
success: function(data){
var videoPlayer = data.posts[0]["video-player"];
$("#DOMWindow").find(".post-inner .video-container").html(videoPlayer);
}
});