title: How to make php variables into javascript variables
body: <p>I am trying to figure out the best way I retrieve php variables with AJAX and then make those variables into javascript variables.</p>
  
  <p>Let's say I have the following within my php file:</p>
  
  <pre><code>echo $total;
  echo $actual;
  </code></pre>
  
  <p>Edit: JSON</p>
  
  <pre><code>echo json_encode($comments);
  </code></pre>
  
  <p>How can I turn these php variables into javascript variables within the AJAX call <code>success: function (data) {</code> or is there a better way to do this?</p>