title: Retrieving values from a multidimensional array jQuery
body: <p>There are tons of questions on multidimensional array with jQuery and Javascript here on Stack and I red them all, but what I understood I guess it's wrong 'cause it doesn't work.</p>
  
  <p>I'm using a <code>$.ajax</code> function that connects to <code>tester2.php</code>. The PHP script, depending on which value the user passes (through a <code>&lt;select&gt;</code> menu) send different queries to the DB and always retrieves a multidimensional array like this one:</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [name] =&gt; carbon
              [lvl] =&gt; 1
          )
  
  )
  </code></pre>
  
  <p>The array is sent back via jQuery, but the problem is that I want to sent:</p>
  
  <ol>
  <li><code>carbon</code> to <code>&lt;div id="txt"&gt;</code></li>
  <li><code>1</code> to <code>&lt;div id="level"&gt;</code></li>
  </ol>
  
  <p>I tried this ways to retrieve the single value from the multidimensional array, methods that I found here on Stack, but any of them works:</p>
  
  <ul>
  <li><code>data[0]["name"]</code></li>
  <li><code>data[0]["name"].value</code></li>
  </ul>
  
  <p>So, do anyone knows how to retrieve the single value from a multidimensional array in jQuery? </p>
  
  <p><em>Note</em>: if I print the array using <code>$("#txt").html(data)</code> the array is there, so it is correctly called back to the HTML page.</p>
  
  <p>HTML page</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
      $("#menuSelect").on("click", function(){
          var str = $("#menuSelect").val();
          $.ajax({
              type: "POST",
              url: "tester2.php",
              data: { value: str },
              success: function(data){
                      var a = data[0]["name"];
                      var b = data[0]["lvl"];
                      $("#txt").html(a);
                      $("#level").html(b);
              }
          })
      })
  });
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="txt" style="background-color:#EF1014"&gt;
  &lt;/div&gt;
  
  &lt;div id="level" style="background-color:#625DDB"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>PHP script</p>
  
  <pre><code>&lt;?php
  include "dbFns.php";
  dbConn();
  
  function provaAJAX($value) {
  switch ($value) {
      case "0":
          $query = dbSelect("name, lvl", "productsma", "id=1", "", "", "Errore nei risultati");
          print_r($query);
          break;
      case "1":
          $query = dbSelect("name, lvl", "productsma", "id=2", "", "", "Errore nei risultati");
          print_r($query);
          break;
      case "2":
          $query = dbSelect("name, lvl", "productsma", "id=3", "", "", "Errore nei risultati");
          print_r($query);
          break;
  }
  }
  
  $value = $_POST["value"];
  provaAJAX($value);
  </code></pre>