用php显示目录视图

I want to display a catalog view of students with php. To be more precisely I have the web page in which I have used jQuery, Ajax to load some parts of the page. What I want to do is to to display a list of students like a catalog with their information in which every item of the list has included first name ,last name, username etc. Also, this item must contain a button. Once the button is clicked the list view should be dismissed and another view with full details of the students should be loaded in the same area.

@Vainglory07 of course I have tried a lot and did not find out any solution. Ok I am posting my code but it is very basic:

<script type="text/javascript">
  $(function(){
  $("#$data").bind('click', function(){



        window.alert("It works");   
                        }

  )}
);

    </script>

Here is the code in php:

$data=mysql_query("SELECT * FROM perdoruesi WHERE id>2 ");



    while($db_field=mysql_fetch_array($data)){

            echo "<tr><td>";

            echo $db_field['emri']. " "; 
            echo $db_field['mbiemri']. " ";
            echo $db_field['username']. " ";
            echo $db_field['passw']. " ";
            $data = $db_field['username'];
            echo "<button id = '$data'>".$data."</button>";                   
         echo "</td></tr>";
          }

when I click the button I want to execute the script but it does nothing. Many thanks for your help.

To match $('#data') you should output id='data':

echo "<button id='data'>".$data."</button>";   

This code: id='$data' gives each button a different id (which is probably not what you want)