title: jquery ajax to return HTML elements
body: <p>Is it possible to return the entire data and innerhtml of a particular div or I have to follow a different approach .. How can I display the data into the popover div.</p>
  
  <p>The code snippet is below
  I am just sending a dummy value as '4' just to check, </p>
  
  <p><strong>account.php</strong></p>
  
  <p>In this page I am using a popover to display content processed via ajax</p>
  
  <pre><code>&lt;a id="popover" href="#" data-trigger="hover" rel="popover" &gt;&lt;img class="img-thumbnail" src="../xxx/xxx/abc.jpg" width="50"/&gt;&lt;/a&gt;
  &lt;div id="popajax"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>jquery</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function() 
      {
          $("#popover").mouseover(function() 
          {
              var textcontent = '4';
              $.ajax({
                      type:'GET',
                      url: "/getuserdetails.php",
                      data: {myval:textcontent},
                      cache: true,
                      error: function(){
                          alert ("ERROR");
                      },
                      success: function(html)
                      {
                          $("#popajax").after(html);
                      }  
                  });
              return false;
  
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>popover script</p>
  
  <pre><code>&lt;script&gt;
   $(function () {
  $("#popover").popover({  trigger: "hover",
  html: true,
   placement : 'top',
    content: function() {
        return $('#popover_content').html();
      },
    title: function() {
        return $('#popover_title').html();
      }
   });
   });
  &lt;/script&gt;
  </code></pre>
  
  <p>getuserdetails.php</p>
  
  <pre><code>&lt;?php   session_start();
  include('include/functions.php'); /* This is for crud and other functions*/
  
      if(isset($_GET['myval']))
      {
      $sql = sql::readOne("SELECT * FROM table_name WHERE id='$_GET[myval]'");
      }
  ?&gt;
  
  &lt;div id="popover_title" class="hide" &gt;
            &lt;h4&gt;&lt;?php echo $sql[0]-&gt;username ?&gt;&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div id="popover_content" class="hide" &gt;
  
              &lt;div&gt; &lt;p&gt; This is Atul Joshi&lt;/p&gt;&lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>*Something Like this</p>
  
  <p><img src="https://i.stack.imgur.com/6nJIq.png" alt="enter image description here"></p>