Stock Price
Example on how to get stock price information from yahoo.finance
HTML
<div id='result'></div>
JavaScript
function getData() {
var url = "http://query.yahooapis.com/v1/public/yql";
var data = encodeURIComponent("select * from yahoo.finance.quotes where symbol in ('HPQ')");
$.getJSON(url, 'q=' + data + "&format=json&diagnostics=true&env=http://datatables.org/alltables.env")
.done(function (data) {
$("#result").text("HP Price: " + data.query.results.quote.LastTradePriceOnly);
})
.fail(function (jqxhr, textStatus, error) {
var err = textStatus + ", " + error;
$("#result").text('Request failed: ' + err);
});
}
getData();