title: Json result into PHP variable
body: <p>I have a script that calls dat from my table and returns it in JSON format. How do I echo out the var <code>nps</code> and <code>data</code> as php variable.</p>
  
  <p>My script:</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "../charts/1-2-4-reports_nps.php?TAG=&lt;?php echo $_SESSION['SectionVar'];?&gt;&amp;From=&lt;?php echo $_SESSION['StartDate'];?&gt;&amp;To=&lt;?php echo $_SESSION['EndDate'];?&gt;",
      cache: false,
      success: function(data){
         var nps = data[0].name;
         console.log(nps);
         var data = data['data'];
         console.log(data);
         $("#div1").append($("&lt;div/&gt;", { id: "div2", text: nps }));
      }
  });
  </code></pre>
  
  <p>My Json returns:</p>
  
  <pre><code>[{"name":"nps","data":[35]}]
  </code></pre>
  
  <p>Something like <code>$nps = data['nps']</code> and echo the result of <code>$nps</code>.</p>