I have this code to get results based in search query:
$(document).ready(function(){
$('#envio').click(function(){
var iURL = "http://ajax.googleapis.com/ajax/services/search/images";
$.ajax({
url: iURL,
type: 'GET',
dataType: 'jsonp',
data: {
v: '1.0',
q: $('#query').val(),
format: 'json',
jsoncallback: '?'
},
success: function(data) {
console.log(data);
var html = '';
$.each(data, function(i, v) {
html += '<img src="' + v.unescapedUrl + '" title="' + v.title + '" alt="' + v.title + '"/>';
});
$('body').append(html);
},
error: function(xhr, textStatus, error){
console.log(xhr.statusText, textStatus, error);
}
});
});
});
This return a Object as you can see in images exposed at this URL: http://www.dropmocks.com/mZX1j. My question is how I can get unescapedUrl value for each result? The $.each in the code before doesn’t work as you can see in images too. you can test it by yourself in this URL http://reyner.subdivx.com/prueba1.php and see the returned JSON or returned Object. Any help?
Cheers and thanks in advance
Try:
The ‘results’ seem to be nested a little deeper according to the console print out.