title: Returning JSON data using jQuery POST function from server
body: <p>I am trying to return a json encoded string from PHP script.</p>
  
  <pre><code>$.post("order.php", { product: product_id, coupon: coupon },
  function(data) {
      $("#price").html("$" + data.price);
      $("#discount").html("$" + data.discount);
      $("#total").html("$" + data.total);
  });
  </code></pre>
  
  <p>I tried to use alert function in callback to see returning value from PHP:</p>
  
  <pre><code>{"price":249,"discount":"0.00","total":249}
  </code></pre>
  
  <p>but value of #price and rest elements is "$undefined".</p>
  
  <p>Please help.</p>