Parse JSON data using jQuery.getJSON()
A simple demo to show how we can parse JSON data using jQuery.getJSON()
HTML
<button>
test
</button>
JavaScript
// The Google Geocoding API url used to get the JSON data
var geocodingAPI = "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true";
$.getJSON(geocodingAPI, function(json) {
$.json = json;
});
$('button').on('click', function() {
alert($.json.status)
});