How to read JSON to take name and status?
I tried everything and [0] - [1] and without it
[
{
"status": "OK"
},
{
"id": "1",
"name": "name test test"
},
{
"id": "1",
"name": "name test"
},
{
"id": "1",
"name": "test name"
}
]
ajax
$.ajax({
url:'url',
method: 'get',
dataType: 'text',
success: function(response){
if (response.status === "200") {
$.each(response, function(i, data) {
alert(data.name);
});
} else {
alert('error status');
}
}
});