Menampilkan Json Google Search Result Menggunakan Jquery

Contoh kode Jquery Google Search Engine :

<script>
// callback function
function GoogleCallback (func, data) {
    window[func](data);
}

// change key!!!
$.getJSON("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=5&start=0&key=YouGoogleAPIkey&q=site:blogspot.co.id+metal&callback=GoogleCallback&context=?",
function(data){
    var ul = document.createElement("ul");
    $.each(data.results, function(i, val){
        var li = document.createElement("li");
        li.innerHTML = '<a href="'+val.url+'" title="'+val.url+'" target="_blank">'+val.title+"</a><br/>"+val.content+"<br/>"+val.url+"<br/><br/>";  
        ul.appendChild(li);
    });
    $('body').html(ul);
});
</script>


Smoga bermanfaat...!
Previous
Next Post »