I'm trying to build a very small service using Apache Cordova and JavaScript, typically I'm trying to avoid JS and use ready solutions, but this question is quite unique.
My app is very simple, it checks for current coordinates (I'm using geolocation API, works very well) and it looks up the coordinates using uk-postcodes.com API and looks for matching postal code and my app should display it. For some reason I cannot make a query to uk-postcodes. My current code looks like that:
var url = "http://uk-postcodes.com/latlng/" + position.coords.latitude + "," + position.coords.longitude + ".json?callback=json";
$.getJSON(url, function (json) {
console.log(json.postcode);
});
I was able to display variable URL and it was working fine so that's not a source of my problem. It looks like that (example) http://uk-postcodes.com/latlng/51.5000,0.1167.json and it works fine.
My problem sits somewhere inside .getJSON code, but I'm not experienced enough to solve and I'm not getting any errors in the console.