Reputation: 107
my code works fine with IE8, Chrome, FireFox, but DOESN't in last Opera 11.5, 11.51
<script>
$.ajax({
url:"https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=barack%20obama&key=ABQIAAAA0WIba2EsveoBgNmpFF4VPBT_f2PMeCqK40xCWP-HTF5Ln8EjvhRvRnHj8jasieBYBypbUK53aU5vOA&mgsz=medium",
dataType:"jsonp",
cache: false,
success: function(data){
for (var i = 0; i < data.responseData.results.length; i++){
$('#imago').append('<img src="' + data.responseData.results[i].tbUrl + '">' + '<br>');
}
}
});
</script>
<div id="imago"></div>
noticed paradox: if I add a line, alerting data.responseData.results[i].tbUrl before appending received tbUrl images, it becomes working in Opera too...
here's example: http://saitostroi.by/im.php
Upvotes: 0
Views: 403
Reputation: 6239
You need to move the DIV you want to insert results into above the script that does the Ajax query. The reason is that Opera doesn't continue parsing (and thus doesn't see the DIV) when jQuery appends a script to the document, until that script is done loading.
Upvotes: 1