title: Having issue showing image returning from database with $.post() jquery and php
body: <p>I'm retrieving a table from database as result of a search action, but when I try to display the result I see the table and the data, but the image returned in each row is not render, I think my problem is in the $('#search').html(data), I'm not sure please someone knows what is the problem?</p>
  
  <p>this is the result</p>
  
  <p><a href="http://s9.postimg.org/mro5qn46n/search_result.jpg" rel="nofollow">http://s9.postimg.org/mro5qn46n/search_result.jpg</a></p>
  
  <p>****This is the search page, where result table is displayed****</p>
  
  <pre><code>&lt;table align="center"&gt;
    &lt;tr&gt;
       &lt;td&gt;
       &lt;label for="criteria"&gt;Select Criteria&lt;/label&gt;
       &lt;/td&gt;
      &lt;td&gt;
         &lt;select name="select" id="criteria"&gt;
             &lt;option selected="true" style="display:none;"&gt;&lt;/option&gt;              
             &lt;option value="value1"&gt;name&lt;/option&gt; 
             &lt;option value="value2"&gt;apartment&lt;/option&gt;
        &lt;/select&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;input type="text" name="value" size="40" maxlength="60" id="value"\&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
        &lt;input name="name-submit" type="button" id="submit" value="Search"\&gt;
  
    &lt;/td&gt;
    &lt;/tr&gt; 
    &lt;tr&gt;
    &lt;td &gt;
    &lt;div id="search"&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;/tr&gt; 
  &lt;/table&gt; 
  
  &lt;script type="text/javascript" src="../js/jquery-1.11.1.min.js"&gt;&lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  $('#submit').click(function(){
  
      var criteria = $("#criteria option:selected").text();
      var    value = $("#value").val();
  
      $.post("search_r.php",{criteria:criteria,value:value},function(data){
  
          $('#search').html(data);
  
            });
  
      });
  
  &lt;/script&gt; 
  </code></pre>
  
  <p>****This is the Page that calls $.post() in the main seach page ****</p>
  
  <pre><code>&lt;?php
  $criteria = $_POST['criteria'];
    $value = $_POST['value'];
  
        $con = mysqli_connect("localhost","root","");
              mysqli_select_db($con,"gables");
  
     $query = "SELECT * FROM residents WHERE $criteria = '$value'";       
    $result = mysqli_query($con,$query);
  
      echo "&lt;table border='1'&gt;
  &lt;tr&gt;
  &lt;th&gt;Id&lt;/th&gt;
  &lt;th&gt;Name&lt;/th&gt;
  &lt;th&gt;Last Name&lt;/th&gt;
  &lt;th&gt;Apartment&lt;/th&gt;
  &lt;th&gt;Parking&lt;/th&gt;
  &lt;th&gt;Phone1&lt;/th&gt;
  &lt;th&gt;Phone2&lt;/th&gt;
  &lt;th&gt;image&lt;/th&gt;
  &lt;/tr&gt;";
  
  while($row = mysqli_fetch_array($result))
  {
    echo "&lt;tr&gt;";
    echo "&lt;td&gt;" . $row['0'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['1'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['2'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['3'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['4'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['5'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['6'] . "&lt;/td&gt;";
  
    echo "&lt;td&gt;&lt;img src=get_image.php?id=".$row['0']." width=160 height=120/&gt;&lt;/td&gt;";   
    echo "&lt;/tr&gt;";
  }
  echo "&lt;/table&gt;";
  
  
  ?&gt;
  </code></pre>
  
  <p>***Here the get_image.php****</p>
  
  <pre><code>&lt;?php
  $con = mysqli_connect("localhost","root","");
         mysqli_select_db($con,"gables");
  
  $id = $_GET['id'];
  
  $query = "SELECT * FROM residents WHERE id='$id'";
  $result = mysqli_query($con,$query);
  
  if($result)
  $picture = mysqli_fetch_array($result);
  header('Content-Type: image/jpg');
  
  echo $picture['11'];
  
  ?&gt;
  </code></pre>