Delete records as per check boxes 'checked' works but cannot refresh the page at the end
Dear All
I had written a jquery that will select multiple records and delete them
The JQUERY
- Deletes the selected records (records whose check boxes are checked)
But, refreshes the page after deleting each record which is
I want to
- Refreshes the page only after deleting all 'selected' records ->at present refreshing the page after deleting each records I amusing following code to refreshing the page
- location.reload(); // refreshes the page
- If possible display the list of records deleted in a DIV .
Please help
JQUERY to delete selected records one by one
- <script language="javascript">
- $(document).ready(function() {
-
- $('#selectall').click(function(event) {
- if(this.checked) { // check select status
- $('.checkbox1').each(function() { //loop through each checkbox
- this.checked = true; //select all checkboxes with class "checkbox1"
- });
- }else{
- $('.checkbox1').each(function() { //loop through each checkbox
- this.checked = false; //deselect all checkboxes with class "checkbox1"
- });
- }
- });
- $('#groupdelete').click(function(){
- var noofcheckbox=$("input[type=checkbox]:checked").length;
- //alert( noofcheckbox);
-
- var checkValues = $('input[name=checkboxlist]:checked').map(function()
- {
- //alert($(this).val());
- var chekboxid=$(this).val().split('checkbox');
- //alert(chekboxid[1]);
- var url = "deleteselectedrecord.php"
- var data = {
- id: chekboxid[1]
- };
- $('#deleteid').val(chekboxid[1]);
- $('#deleteselectedrecorddiv').load(url, data,abcd); // return $(this).val();
-
- }).get()
- });
- function abcd () {
-
- location.reload(); // refreshes the page
- }
- });
- </script>
PHP Code
- session_start();
- include("../includes/dbconnect.php");
- include_once("../includes/functions.inc.php");
- include_once("../includes/config.inc.php");
-
-
- $id=$_REQUEST['id'];
- $dquery=sprintf("delete from enquiry where id=%d",$id);
-
- mysql_select_db($database_DBconnect, $DBconnect);
- $vsResult = mysql_query($dquery, $DBconnect) or die(mysql_error());
- if ($vsResult )
- { echo '<br>Deleted '.$id; /// I can see only last ID
- }
- ?>