JSFiddle - React, Tailwind, and code Playground
by whitewolf
JavaScript
var code = 'SYD';
$.getJSON("http://query.yahooapis.com/v1/public/yql",
{
q: "select * from json where url=\"http://airportcode.riobard.com/airport/" + code + "?fmt=JSON\"",
format: "json"
},
function (data) {
if (data.query.results) {
alert(data.query.results.json.code + '\n' +
data.query.results.json.name + '\n' +
data.query.results.json.location);
} else {
alert('no such code: ' + code);
}
}
);