Hi there,
I am making an ajax request to a PHP page and returning the results as a JSON array.
Where I am having a hard time is grabbing the specific parts of the array to display on my page.
I'm using Chrome's javascript console and logging to the console, so I can see the returned array. Here is an example result.
In my JQuery postback success function, if I do the following, I see the above result.
but if I just want to show the member_name of user 1, I can't identify how to do that. I would think I could use _data.0.member_name, but that doesn't work and I've tried _data[0].member_name also with an undefined result also.
Any assistance or direction would be greatly appreciated.
I am making an ajax request to a PHP page and returning the results as a JSON array.
Where I am having a hard time is grabbing the specific parts of the array to display on my page.
I'm using Chrome's javascript console and logging to the console, so I can see the returned array. Here is an example result.
Code:
{"0":{"id_member":"2","member_name":"User 1"},"1":{"id_member":"5","member_name":"User 2"},"2":{"id_member":"619","member_name":"User 3"},"status":100,"message":"Success!"}
In my JQuery postback success function, if I do the following, I see the above result.
Code:
function PostbackSuccess_ShowResults(_data, textStatus, XMLHttpRequest) {
console.log(_data);
$('#showData').html(_data);
//alert("Postback Sucess");
}
but if I just want to show the member_name of user 1, I can't identify how to do that. I would think I could use _data.0.member_name, but that doesn't work and I've tried _data[0].member_name also with an undefined result also.
Any assistance or direction would be greatly appreciated.