I'm trying to access a variable outside of my jquery .get request, but it keeps saying 'undefined'.
The code I'm using is as follows:
var userlat;
$.get("/ajax/getInitCoords", {}, function(data) {
userlat = data.lat;
});
console.log(userlat);
If I move the console log part inside the brackets it works fine, but I need to access it outside that.