In search.php before sending $rows in json_encode() give one condition that will check $row is empty or not.like :
if(!empty($res))
echo json_encode(array('status'=>'success','result'=>$rows));
else
echo json_encode(array('status'=>'failed','result'=>[]));
In ajax check
success: function(html)
{
if(html.status=='success')
{
$res.show();
$res.append(result.html);
console.log(result.html);
}
}
may be it will work..