Yahoo API ajax request demo
by awolf2904
HTML
<pre id="out"></pre>
JavaScript
$(function () {
$.ajax({
url: "http://query.yahooapis.com/v1/public/yql",
// The name of the callback parameter, as specified by the YQL service
jsonp: "callback",
// Tell jQuery we're expecting JSONP
dataType: "jsonp",
// Tell YQL what we want and that we want JSON
data: {
q: "select * from search.ec (1, 10) WHERE keyword='New York'", // search.ec seems to be an ecommerce search for taiwanese people
//q: "desc nyt.people.newsfeed",
format: "json",
env: "http://datatables.org/alltables.env"
},
// Work with the response
success: function (response) {
//console.log(response); // server response
$('#out').text(JSON.stringify(response, null, 2));
}
});
});