title: Jquery ajax parse html from json response
body: <p>I need select a div by id from html in json response.</p>
  
  <p>In server side:</p>
  
  <pre><code>    ob_start();
  
      extract($this-&gt;validate($this-&gt;data));
      require("classes/View/". $this-&gt;view . ".phtml");
  
      $content = ob_get_contents();
      ob_end_clean();
  
      header('Content-type: application/json');
  
      echo json_encode(array(
          'messages' =&gt; $this-&gt;data["messages"],
          'content' =&gt; $content
  ));
  </code></pre>
  
  <p>and in client side:</p>
  
  <pre><code>    $.ajax({  
          type: "POST",  
          url: o.url ,
          dataType: "JSON",
          data: o.ajax_data,
          success: function(response) {
                      $("#mydiv").html($(response.content).find("#mydiv"));
          }
      });
  </code></pre>
  
  <p>Before, when I used HTML as dataType and I returned plain HTML as response, everything have been functional.  I can't figure out the right solution even after hours of research.
  Can anybody help me please?</p>
  
  <p><strong>===UPDATE 1===</strong></p>
  
  <p>console.log(response.content) => {"messages":[],"content":"complete escaped html site here"}</p>