After querying an API with Ajax, I found that I couldn't access the results outside of the ajax constructs.
Every time I try to use the xx variable, it says xx is undefined.
The main issue here is how can I make use of the xx variable outside of the ajax constructs?
Could someone please advise me on how to achieve this?
$.ajax({
type: "GET",
url: url,
dataType : "json",
success: function(data){
var xx = (data.results[0].formatted_address);
}
})