title: 2D array as return value from ajax
body: <p>I am not only new here, but also a total beginner in programming.
  I have programmed a small web application that uses &quot;Ajax&quot; to update data in the front panel. The first version works, but is very cumbersome and also takes a long time.</p>
  <pre><code>function updateAll(article){
                  document.getElementById(&quot;artnr&quot;).value = article.options[article.selectedIndex].text;
                  document.getElementById(&quot;SaveMessage&quot;).innerHTML = &quot;&quot;;
                  
                  // 1. Anzahl der Aufträge ermitteln
                  $.ajax({
                      type: 'GET',
                      url: 'cntOrder.php',
                      data: $(article),
                      success: function(data){document.getElementById(&quot;cntOrder&quot;).value = data;}
                  });
  
                  // 2. Median aller Uem-Werte
                  $.ajax({
                      type: 'GET',
                      url: 'setPoint.php',
                      data: $(article),
                      success: function(data){document.getElementById(&quot;setPoint&quot;).value = data; calcTarLim(data);}
                  }); // Aufruf 4. über &quot;calcTarLim()&quot;
                  
                  // 3. Aktuelle Grenze auslesen
                  $.ajax({
                      type: 'GET',
                      url: 'curLim.php',
                      data: $(article),
                      success: function(data){document.getElementById(&quot;curLim&quot;).value = data;}
                  });
  
                  // 5. Graph aktualisieren (Messwerte, currentLimit und targetLimit)
              }
              
              // 4. Zielwert für Grenze berechnen
              function calcTarLim(data){
                  let tol = parseFloat(document.getElementById(&quot;tolLim&quot;).value);
                  let soll = 0;
                  if(data == 'change'){
                      window.alert(&quot;if: &quot; + data);
                  } else {
                      soll = parseFloat(data);
                  }
                  let ziel = soll * ((100-tol)/100);
                  ziel = ziel.toFixed(2);
                  document.getElementById(&quot;tarLim&quot;).value = ziel;
              }
  </code></pre>
  <p>Now my idea was to handle all queries in one Ajax query and put the different return values in an array and then evaluate them using the keys.
  Unfortunately I don't get any values out.</p>
  <pre><code>function updateAll(article){
                  document.getElementById(&quot;artnr&quot;).value = article.options[article.selectedIndex].text;
                  document.getElementById(&quot;SaveMessage&quot;).innerHTML = &quot;&quot;;
                  
                  // 1. Ajax Aufruf, Datenbankfunktionen
                  $.ajax({
                      type: 'GET',
                      url: 'ajax.php',
                      data: $(article),
                      success: function(data){
                          window.alert(data);
                          document.getElementById(&quot;cntOrder&quot;).value = data['cntOrder']['cnt'];
                          document.getElementById(&quot;setPoint&quot;).value = data['setPoint'];
                          document.getElementById(&quot;curLim&quot;).value = data['CurLim']['uemmin'];
                          calcTarLim(data['setPoint']);
                      }
                  });
  </code></pre>
  <p>Data looks like this:</p>
  <pre><code>Array
  (
      [cntOrder] =&gt; Array
          (
              [cnt] =&gt; 6
          )
  
      [curLim] =&gt; Array
          (
              [uemmin] =&gt; 16.00
          )
  
      [setPoint] =&gt; 26.28
  )
  </code></pre>
  <p>Thanks in advance for any help. If more data is needed, I will of course add it.</p>