I understand that I can make a crossdomain ajax call with jquery, .ajax, and jsonp. I am calling the yahoo stock quote api. Everything is working and the result is returning
Here is a js fiddle for this: https://jsfiddle.net/vham369w/1/
using $.getJson instead of $.ajax
JS
$(document).ready(function() {
var symbol = 'AAPL'
var url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%3D%22"+symbol+"%22&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
$.getJSON(url + "&callback=?", null, function(data) {
console.log(data);
$("#realtime").text("$" + data.query.results.quote.AskRealtime);
$("#ask").text("$" + data.query.results.quote.Ask);
});
});
HTML
Ask:
loading ask
Realtime (null if market is closed):
loading realtime