Sorry for posting simple issue which I failed to find out:
public function show(){
function display(){
    $q = DB::table('posts')->get();
    return $q;
  }
    $m      = new Post;
    $data  = $m->display();
    foreach($data as $row)
    {
        ?>
            <tr>
                <td><?= $row->id ?></td>
                <td><?= $row->name ?></td>
                <td><?= $row->description ?></td>
            </tr>
        <?
    }
    exit();
}
mainly the problem I am facing with the foreach loop in controller wich I am trying to display with ajax request in view.
 
    