Search
 
SCRIPT & CODE EXAMPLE
 

PHP

delete data with ajax in php

function del() 
{
	$(document).delegate(".btn-delete-employee", "click", function() {

		if (confirm("Are you sure you want to delete this record?")) {
		    var employeeId = $(this).attr('data-id'); //get the employee ID

		    // Ajax config
			$.ajax({
		        type: "GET", //we are using GET method to get data from server side
		        url: 'delete.php', // get the route value
		        data: {employee_id:employeeId}, //set data
		        beforeSend: function () {//We add this before send to disable the button once we submit it so that we prevent the multiple click
		            
		        },
		        success: function (response) {//once the request successfully process to the server side it will return result here
		            // Reload lists of employees
	            	all();

		            alert(response)
		        }
		    });
		}
	});
}
Comment

PREVIOUS NEXT
Code Example
Php :: ternaire echo isset php 
Php :: The media must not be greater than 12288 kilobytes in laravel 
Php :: php move element to beginning of array 
Php :: radio button select in php 
Php :: one lin if statement php 
Php :: php array_push in foreach duplicate 
Php :: laravel factory relations data 
Php :: contact form 7 get form id 
Php :: laravel request unique 
Php :: read xml file in php wordpress 
Php :: php get all array keys in json 
Php :: Notice: Array to string conversion php 
Php :: php static variable 
Php :: PHP str_word_count — Return information about words used in a string 
Php :: Undefined constant "STDOUT" in php 
Php :: integrate fontawesome in blade laravel 
Php :: remove more than one space in string php 
Php :: nginx codeigniter remove index.php 
Php :: laravel passport client 
Php :: livewire from one component to another 
Php :: rule for radio button in laravel 
Php :: wordpress nav menu align right 
Php :: laravel request validation rules for create and update 
Php :: delay in php 
Php :: laravel invoice toturial 
Php :: How To Force Redirect HTTP To HTTPS In Laravel Using ServiceProvider 
Php :: how to create constant in php 
Php :: find object in array php 
Php :: random string number generator in php codeigniter 
Php :: executar comando linux php 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =