title: my edit button doesnt work on the next page (only work on the first page)
body: <p>my edit and delete query only work on the first page of datatables, but not on the second page.
  i'm using ajax and jquery. i'm new and this is for my project in college. thanks for helping me.
  here's the code.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> &lt;script&gt;
         $(function () {
      $("#example1").DataTable();
      $('#example2').DataTable({
        "paging": true,
        "lengthChange": false,
        "searching": false,
        "ordering": true,
        "info": true,
        "autoWidth": false
      });
    });
  
      &lt;/script&gt;
      
      &lt;script type="text/javascript"&gt;
        $(document).ready(function (){
          $(".open_modal").click(function (e){
            var m = $(this).attr("id");
            $.ajax({
              url: "user_edit.php",
              type: "GET",
              data : {username: m,},
              success: function (ajaxData){
                $("#ModalEdit").html(ajaxData);
                $("#ModalEdit").modal('show',{backdrop: 'true'});
              }
            });
          });
        });
      &lt;/script&gt;
  
      &lt;script type="text/javascript"&gt;
       $(document).ready(function (){
        $(".open_delete").click(function (e){
          var m = $(this).attr("id");
          $.ajax({
            url: "user_delete.php",
            type: "GET",
            data : {username: m,},
            success: function (ajaxData){
              $("#ModalDelete").html(ajaxData);
              $("#ModalDelete").modal('show',{backdrop: 'true'});
            }
          });
        });
      });
    &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button type="button" data-toggle="modal" data-target="#tambah" class="btn btn-info"&gt;&lt;i class="glyphicon glyphicon-plus"&gt;&lt;/i&gt; Tambah User&lt;/button&gt;
              &lt;/br&gt;
              &lt;/br&gt;
  
              &lt;?php include"alert.php"; ?&gt;
              &lt;table id="example1" class="table table-bordered table-striped" &gt;
                &lt;thead&gt;
                  &lt;tr&gt;
                    &lt;th&gt;Nomor&lt;/th&gt;
                    &lt;th&gt;Username&lt;/th&gt;
                    &lt;th&gt;Nama Lengkap&lt;/th&gt;
                    &lt;th&gt;Password&lt;/th&gt;
                    &lt;th&gt;Level&lt;/th&gt;
                    &lt;th&gt;Nama Toko&lt;/th&gt;
                    &lt;th&gt;Action&lt;/th&gt;   
                  &lt;/tr&gt;
                &lt;/thead&gt;
  
                &lt;tbody&gt;
                &lt;?php 
                include "connection.php";
                $query_mysql = mysqli_query($connection,"SELECT username, password, level, nama_lengkap, status, nama_toko FROM master_user INNER JOIN master_toko ON master_user.id_toko = master_toko.id_toko where status='0'")or die(mysqli_error());
  
                $nomor = 1;
                while($data = mysqli_fetch_array($query_mysql)){
                  ?&gt;
                    &lt;tr&gt;
                      &lt;td&gt;&lt;?php echo $nomor++; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['username']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['nama_lengkap']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['password']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['level']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['nama_toko']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;
                        &lt;a href="#" class='btn btn-primary open_modal' id='&lt;?php echo $data['username']; ?&gt;'&gt;&lt;span class="glyphicon glyphicon-pencil" style="padding-right: 2px"&gt;&lt;/span&gt;Edit&lt;/a&gt; |
                        &lt;a href="#" class='btn btn-danger open_delete' id='&lt;?php echo $data['username']; ?&gt;'&gt;&lt;span class="glyphicon glyphicon-trash" style="padding-right: 2px"&gt;&lt;/span&gt;Hapus&lt;/a&gt;        
                      &lt;/td&gt;
                    &lt;/tr&gt;  &lt;?php } ?&gt;
                  &lt;/tbody&gt;
                 
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/section&gt;
      
     &lt;!-- FOR EDIT AND DELETE --&gt;
      &lt;div id="ModalEdit" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
      &lt;/div&gt;
  
      &lt;div id="ModalDelete" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
      &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>and this is for edit 
  i reference the username because username is my primary key
  here the code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    include "connection.php";
      $username = $_GET['username'];
      echo $username;
      $ambildata = mysqli_query($connection,"select * from master_user where username='$username'");
      
      while($row=  mysqli_fetch_array($ambildata)){
  ?&gt;
  
  &lt;div class="modal-dialog"&gt;
      &lt;div class="modal-content"&gt;
          &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;
                &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
              &lt;/button&gt;
              &lt;h4 class="modal-title" id="myModalLabel"&gt;Edit User&lt;/h4&gt;
          &lt;/div&gt;
          &lt;div class="modal-body"&gt;
              &lt;form class="form-horizontal" action="proses_edituser.php" name="modal-popup" enctype="multipart/form-data" method="POST" id="form-edit"&gt;
             
                  &lt;div class="form-group"&gt;
                      &lt;label class=" control-label col-md-3"&gt;Username&lt;/label&gt;
                          &lt;div class="col-md-9"&gt;
                              &lt;input class="form-control" type="text" name="username" value="&lt;?php echo $row['username']; ?&gt;"/&gt;
                              
                              &lt;span class="help-block"&gt;&lt;/span&gt;
                          &lt;/div&gt;
                  &lt;/div&gt;
                              
                  &lt;div class="form-group"&gt;
                      &lt;label class="col-md-3 control-label"&gt;Nama Lengkap&lt;/label&gt;
                          &lt;div class="col-md-9"&gt;
                         &lt;input  class="form-control" type="text" name="nama_lengkap" value="&lt;?php echo $row['nama_lengkap']; ?&gt;"/&gt;
                          &lt;span class="help-block"&gt;&lt;/span&gt;
                          &lt;/div&gt;
                  &lt;/div&gt;
                              
                  &lt;div class="form-group"&gt;
                       &lt;label class="col-md-3 control-label"&gt;Password&lt;/label&gt;
                          &lt;div class="col-md-9"&gt;
                          &lt;input class="form-control" type="password" name="password" value="&lt;?php echo $row['password']; ?&gt;"/&gt;
              &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                      &lt;label class="control-label col-md-3"&gt;Level&lt;/label&gt;
                          &lt;div class="col-md-9"&gt;
                               &lt;select name="level" class="form-control"&gt;
                                            &lt;option value=''&gt;--Select--&lt;/option&gt;
                                            &lt;option value='owner' &lt;?php if ($row['level']=='owner'){echo"SELECTED";}?&gt;&gt;Owner&lt;/option&gt;
                                            &lt;option value='manajer' &lt;?php if($row['level'] == 'manajer'){ echo "SELECTED"; } ?&gt;&gt;Manajer&lt;/option&gt;
                                            &lt;option value='bendahara' &lt;?php if($row['level'] == 'bendahara'){ echo "SELECTED"; } ?&gt; &gt;Bendahara&lt;/option&gt;
                                            &lt;option value='administrator' &lt;?php if($row['level'] == 'administrator'){ echo "SELECTED"; } ?&gt;&gt;Administrator&lt;/option&gt;
                                        &lt;/select&gt;
                              &lt;span class="help-block"&gt;&lt;/span&gt;
                          &lt;/div&gt;
                  &lt;/div&gt;
  
                   &lt;div class="form-group"&gt;
                      &lt;label class="control-label col-md-3"&gt;Toko&lt;/label&gt;
                      &lt;div class="col-md-9"&gt;
                        &lt;select name="id_toko" class="form-control"&gt;
                          &lt;option value=""&gt;-- Pilih Toko --&lt;/option&gt;
                          &lt;?php
                            require "connection.php";
                            $datatoko = "SELECT * FROM master_toko ORDER BY id_toko ASC";
                            $resultsql = mysqli_query($connection, $datatoko);
                            if (mysqli_num_rows($resultsql) &gt; 0) {
                              while ($row = mysqli_fetch_assoc($resultsql)) {
                               
                               echo "&lt;option value='$row[id_toko]'&gt;$row[nama_toko]&lt;/option&gt;";
  
                               // $nama_toko = $row['nama_toko'];
                                //echo '&lt;option value="'.$row['id_toko'].'"&gt;'. $nama_toko.'&lt;/option&gt;';
                              }
                            }        
                        ?&gt;
                      &lt;/select&gt;
                      
                    &lt;/div&gt;
                  &lt;/div&gt;
                
      
      
        &lt;div class="modal-footer"&gt;
                  &lt;button type="submit" class="btn btn-success" value="Simpan"&gt;&lt;span class="glyphicon glyphicon-floppy-saved" style="padding-right: 2px"&gt;&lt;/span&gt;Simpan&lt;/button&gt;
                  &lt;button class="btn btn-danger" data-dismiss="modal" aria-hidden="true"&gt;&lt;span class="glyphicon glyphicon-floppy-remove" style="padding-right: 2px"&gt;&lt;/span&gt;Batal&lt;/button&gt;                
              &lt;/div&gt;
              &lt;/form&gt;
      
              &lt;?php
      }
              ?&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>