my data table file getting result in ajax response can not set response in data table automatically set @ top of page me give class in div can not proper result:
<?php include 'header.php'; include 'footer.php'; if(isset($_request['delete_id'])) { $delete_id = $_request['delete_id']; $query = "delete contact, address, addressgroup contact, address, addressgroup contact.contact_id = '$delete_id' , address.contact_id = '$delete_id' , addressgroup.contact_id='$delete_id'"; $query = mysql_query($query); } ?> <head> <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.2/js/jquery.datatables.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#example').datatable( { "pagingtype": "full_numbers" } ); } ); var myarray; function getcon() { myarray = []; myarray.push($(".group_id").val()); $.ajax({ type: "post", url: "getcon.php", data: 'group_id=' + myarray.join(), success: function(data) { $('.group').html(data); } }); return false; } </script> </head> <div class="wrapper row-offcanvas row-offcanvas-left"> <?php include 'admin_leftside.php'; ?> <aside class="right-side"> <section class="content-header"> <h1>contact list</h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> home</a></li> <li class="active">contact list</li> </ol> </section> <section class="content"> <div class="row"> <div class="col-md-11"> <div class="box box-primary"> <div class="box-header"></div> <div class="box-body"> <form method="post"> <table id="example" class="display" width="100%" cellspacing="0"> <thead> <tr> <td> <select class="group_id" name="group_id[]" onchange="getcon();" multiple> <option disabled selected>select group</option> <?php $select = "select group_id,group_name `group`"; $res1 = mysql_query($select); while($group1 = mysql_fetch_array($res1)) { echo '<option value='.$group1['group_id'].'>'.$group1['group_name'].'</option>'; } ?> </select> </td> </tr> <tr> <th> </th> <th> </th> <th> </th> <th>user name</th> <th>password</th> <th>first name</th> <th>middle name</th> <th>last name</th> </tr> <tbody> <tr> <div class="group"></div> </tr> </tbody> </thead> </table> </div> </div> </div> </aside><!-- /.right-side --> </div><!-- ./wrapper -->
try adding line
$("#example").datatable().fndestroy(); var table= $('#example').datatable({"order": []});
after
$('.group').html(data);
this reload data table
Comments
Post a Comment