title: returning multiple variables in JSON/PHP
body: <p>Basically, i'm using an JSON response from a <strong>local PHP file</strong> to append data inside a div, currently it's only returning one variable, in which the code i'm using is shown here : </p>
  
  <pre><code>    $.ajax({
          url: "functions/ajax.php",
          data: "func=auto",
          type: "GET",
          dataType: "json",
          success: function(data){
              $.each(data.search, function (i, v) {
                      $div = $('.bs-docs-example');
                      $div.append('+ v +');
              });
          },
          error: function (jqXHR, textStatus, errorThrown){
              console.log('Error ' + jqXHR);
          }
      });
  </code></pre>
  
  <p>The code which is returning the JSON is currently</p>
  
  <pre><code>while($row = mysql_fetch_assoc($res)) {
       $search[] = $row['number'];
  }
  echo json_encode($search);
  </code></pre>
  
  <p>What i want to do is something like this</p>
  
  <pre><code>while($row = mysql_fetch_assoc($res)) {
       $search[] = $row['number'];
       $search[] = $row['name'];
  }
  echo json_encode($search);
  </code></pre>
  
  <p>But if i was to do the following, how would i access both <code>number</code> and <code>name</code> since in the <code>success</code> on the jQuery it's parsing using <code>$.each(data.search, function (i, v) {</code> which means the original <code>$search[] = $row['number']</code> is now stored inside <code>v</code> </p>
  
  <p>would i do something like <code>v['name']</code> <code>v['number']</code> or is that completely wrong ?</p>