I have json file
{
"arr": [
{
"text1": "first",
"text2": "second",
},
{
"text11": "first",
"text22": "second",
}
]
}
and I want get this object.
$.ajax({
url: '../test.json',
dataType: 'json',
type: 'get',
cache: 'false',
success: function(data) {
console.log(data.arr);
}
});
and this are working. But if I want assign a value to a variable, it doesn't work.
success: function(data) {
var arrTest = data.arr;
}
console.log(arrTest);
return arrTest is not defined