title: PHP: how to extract ajax array response
body: <p>I am getting ajax response in array format from php url. How to extract array response values in jQuery?
  FYI:</p>
  
  <p>PHP array is:</p>
  
  <pre><code>$response = array('msg' =&gt; 'Hello', 'html' =&gt; '&lt;b&gt;Good bye&lt;/b&gt;');
  </code></pre>
  
  <p>I am getting $response array in my ajax response. i.e.</p>
  
  <pre><code>var promo = "promo=45fdf4684sfd";
  $.ajax({
      type: "POST",
      url: baseJsUrl + "/users/calc_discount",
      data: promo,
      success: function (msg) { // I am getting $response here as ajax response.
          //alert(msg);
  
          // Here I want to check whether response is in array format or not. if it is in array format, I want to extract msg here and want to use response array values.
      }
  });
  </code></pre>
  
  <p>Let me know answer pls.
  Thanks.</p>