Wednesday, 7 August 2013

get values in pairs from json array

get values in pairs from json array

Firstly, this is my json value i am getting from a php source:
[{"oid":"2","cid":"107"},{"oid":"4","cid":"98"},{"oid":"4","cid":"99"}]
After that, I want to get and oid value along with the corresponding cid
value for example, oid=2 and cid=107 at one go, oid=4 and cid=98 at
another and so on. I am trying to use jquery, ajax for this.
I have tried many answers for this, like: Javascript: Getting all keys
existing in JSON array and loop and get key/value pair for JSON array
using jQuery but they don't solve my problem.
I myself tried to loop through the keys but it returns a undefined everytime.

No comments:

Post a Comment