Reputation: 29
Read json data value.
Getting the following result(json encoded)
[{"client_id":1,"client_first_name":"Pooja"}]null
how can i read "client_first_name" value.
$.ajax({
type: "POST",
data: {id: clientid},
dataType: 'json',
url: webURL + "/invoice/clientdetail/",
success: function(data)
{
var res = json_encode(data);
}
});
how can i read "client_first_name" value
*data- getting json array, how can i read particular value.
Upvotes: 0
Views: 4660
Reputation: 1443
Assuming that your "res" jSON looks something like this:
{"client_first_name":"value"}
You are reading the value in this way:
res[0]['client_first_name']
Please reffer to:
how to get data to javascript from php using json_encode?
Upvotes: 2