I'm trying to use the Dynamic Async iFrame method, but my code isn't working and I'm confused about what I'm doing wrong. The iFrame itself is loading, but it isn't showing the expected web page. See what I mean.
Here is my code. What am I doing wrong?
<script>
(function(d){
var iframe = d.body.appendChild(d.createElement('iframe')),
doc = iframe.contentWindow.document;
// style the iframe with some CSS
iframe.style.cssText = "width:900px;height:600px;";
doc.open().write('<body onload="' +
'var d = document;d.getElementsByTagName(\'head\')[0].' +
'appendChild(d.createElement(\'script\')).src' +
'=\'http://www.uab.edu/dining/locations\'">');
doc.close(); //iframe onload event happens
})(document);
</script>
EDIT: Solution Code
<%= javascript_tag do %>
$(window).load( function(){
window.map = '<%= j @college.map.html_safe %>';
window.street_view = '<%= j @college.street_view.html_safe %>';
window.food = '<%= j @college.food.html_safe %>';
window.housing = '<%= j @college.housing.html_safe %>';
window.weather = '<%= j @college.weather.html_safe %>';
$('#map').html(map);
$('#street_view').html(street_view);
$('#food_iframe').html(food);
$('#housing_iframe').html(housing);
$('#weather_section').html(weather);
});
<% end %>