title: get values in pairs from json array
body: <p>Firstly, this is my json value i am getting from a php source:</p>
  
  <pre><code>[{"oid":"2","cid":"107"},{"oid":"4","cid":"98"},{"oid":"4","cid":"99"}]
  </code></pre>
  
  <p>After that, I want to get and <code>oid</code> value along with the corresponding <code>cid</code> value for example, <code>oid=2</code> and <code>cid=107</code> at one go, <code>oid=4</code> and <code>cid=98</code> at another and so on. I am trying to use jquery, ajax for this.</p>
  
  <p>I have tried many answers for this, like: <a href="https://stackoverflow.com/questions/9767133/javascript-getting-all-keys-existing-in-json-array">Javascript: Getting all existing keys in a JSON array</a> and <a href="https://stackoverflow.com/questions/7861032/loop-and-get-key-value-pair-for-json-array-using-jquery">loop and get key/value pair for JSON array using jQuery</a> but they don't solve my problem.</p>
  
  <p>I tried this:</p>
  
  <p><code>for (var i = 0; i &lt; L; i++) {
      var obj = res[i];
      for (var j in obj) {
          alert(j);
      }</code></p>
  
  <p>but all this did was to return the key name, which again did not work on being used.</p>