I have an AJAX get request where I want to send some of the data it receives into a global variable to be used elsewhere, but for some reason I can't seem to be able to connect the private variable with the global? Thanks.
$.ajax({
url: "-jsonurl-",
type: "GET",
data: {},
dataType: "json",
success: function (results) {
AjaxResult(results);
}
});
function AjaxResult(results) {
Label = results;
console.log(Label) // <------ displays correct JSON data
};
var Label;
console.log(Label) // <------ returns as undefined???