Why is username undefined? I can be sure that the JSON file format is right.
I need set username as the global variable, is there any way i can workaround this?
var loginProfile = 'link to JSON file';
var username;
$.getJSON(loginProfile, function (data) {
username = data.USERNAME;
});
alert(username);