title: How can I use json on localhost (MAMP)?
body: <p>index.php </p>
  
  <pre><code>    &lt;button class="button"&gt;color&lt;/button&gt;
      &lt;div class="blue"&gt;&lt;/div&gt;
      &lt;div class="red"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>script.js</p>
  
  <pre><code>$(".button").click(function(){
    $.ajax({
          url: "update.php",
          type: "POST",
          success: function (data) {
              $(".blue").html(data.blue);
              $(".red").html(data.red);
                alert("success");
          }
      })
  });
  </code></pre>
  
  <p>update.php</p>
  
  <pre><code>$array['blue'] = "blue content";
  $array['red'] = "red content";
  header('Content-type: application/json');
  echo json_encode($array);
  </code></pre>
  
  <p>I want to work with json on localhost. But it is not working.
  I am using MAMP. </p>