hello to all I am new on this I try save the result on outside variable to use late on coming from a petition using jsonp
var user = null;
gettingUser()
function gettingUser() {
$.getJSON("https://myapi.com/users/profile/?userid=" + id + "&jsonp=?", function (json) {
getData(json);
});
console.log(user) // this is null here why ?
}
getData(data){
user = data
}
all ways I get null in the var user I need help thanks