I have the following jQuery:
$.getJSON('http://www.geoplugin.net/extras/postalcode.gp?format=json', function(data) {
console.log(data.geoplugin_postCode);
var zipCode = data.geoplugin_postCode;
alert(zipCode);
});
alert(zipCode);
for some reason when I do that alert below,
alert(zipCode)
I get undefined. I need the zipCode to be accessible outside of jQuery. I get the alert for zipCode inside the getJSON.