i learning JS a few months, i has written simple scripts. But now i collide with a problem which i can't formulate in Google. I have the program
var iWantValueFromAjax = "im empty";
$.ajax({
type: "POST",
dataType:'jsonp',
url: "https://api.novaposhta.ua/v2.0/json/",
data: {
"modelName": "Address",
"calledMethod": "getCities",
"methodProperties":{},
"apiKey": "6f94a6391cb5134ee68ddb7924de2a3d"},
success: function(msg){
iWantValueFromAjax = msg.data.map(function(e) {
return (e.Description);
});
},
}
);
console.log(iWantValueFromAjax);
I see what value variable "iWantValueFromAjax" is not changed. I suspect that i don't understand issue jquery's scope. May be i don't understand idea scope whole, lol.