title: How to pass HTML with json and ajax
body: <p>I'm trying to display the output from the database using JSON Encode function and Ajax. But, I'm getting difficult on how to pass the html element "" and the php "eg." variable that show data from the server.I want the output to be displayed using json and ajax request.Thanks. </p>
  
  <p>Here's my codes </p>
  
  <pre><code> //js
    function mpo() 
   {
       $.ajax({
           url: "main.php",
           cache: false,
           success: function(html){
               $("#show_div").html(html);
           }
       });
   }
  
  
  //php
  
  $bu = "&lt;div class='main' style='margin-left:" .($level*60). "px'&gt;";     
  $bu = "&lt;div class='main_one'&gt;";
  $bu = "&lt;div class='main_User'&gt;" .($same[2]) . "&lt;/div&gt;";
  $bu = "&lt;div class='main_Msg'&gt;" .($same[3]) . "&lt;/div&gt;";
  $bu = "&lt;div class='main_Date'&gt;" . ($same[4]) . "&lt;/div&gt;";
  $json  =array('bu'=&gt;$bu);
  echo json_encode($json);        
  </code></pre>