{"id":5320,"date":"2020-08-19T05:54:49","date_gmt":"2020-08-19T05:54:49","guid":{"rendered":"https:\/\/infyblog.zluck.in\/?p=5320"},"modified":"2025-07-17T06:35:31","modified_gmt":"2025-07-17T06:35:31","slug":"how-to-delete-record-using-ajax-in-laravel","status":"publish","type":"post","link":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/","title":{"rendered":"How to Delete Record using ajax call with Laravel"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"5320\" class=\"elementor elementor-5320\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-52cb468 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"52cb468\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-afef55a\" data-id=\"afef55a\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\n\t\t<div class=\"elementor-element elementor-element-803670d elementor-widget elementor-widget-text-editor\" data-id=\"803670d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>We work on projects with the admin panel every day. In which we mostly use data tables and we need to delete the record from the data table without page refresh.<\/p><p>So, today I will show you how to extract a record using Ajax. It&#8217;s very easy to integrate.<\/p><p>Let&#8217;s take one example. I have a Category data table and I want to delete one category from the table without refreshing the page. Now, what am I doing for that? First of all, I add a class for the listen to a click event into the delete button and it says delete-btn.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f968687 elementor-widget elementor-widget-video\" data-id=\"f968687\" data-element_type=\"widget\" data-settings=\"{&quot;youtube_url&quot;:&quot;https:\\\/\\\/youtu.be\\\/4Q0yG_Sm_dw&quot;,&quot;video_type&quot;:&quot;youtube&quot;,&quot;controls&quot;:&quot;yes&quot;}\" data-widget_type=\"video.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"elementor-wrapper elementor-open-inline\">\n\t\t\t<div class=\"elementor-video\"><\/div>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-73475fd elementor-widget elementor-widget-text-editor\" data-id=\"73475fd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>See the following image for where I added a class.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f0b04f2 elementor-widget elementor-widget-image\" data-id=\"f0b04f2\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"527\" src=\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/1-2-1024x674.png\" class=\"attachment-large size-large wp-image-5326\" alt=\"1 (2)\" srcset=\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/1-2-1024x674.png 1024w, https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/1-2-300x197.png 300w, https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/1-2-768x506.png 768w, https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/1-2.png 1267w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-813e55b elementor-widget elementor-widget-text-editor\" data-id=\"813e55b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>I used SweetAlert for the confirmation popup. let add sweet alert&#8217;s CSN into the index.blade.php.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b94a6c8 elementor-widget elementor-widget-code-highlight\" data-id=\"b94a6c8\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp><link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/sweetalert\/1.1.3\/sweetalert.min.css\"> \r\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/sweetalert\/1.1.3\/sweetalert.min.js\"><\/script><\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4599602 elementor-widget elementor-widget-text-editor\" data-id=\"4599602\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Let&#8217;s declare routes of the delete record.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-98482f8 elementor-widget elementor-widget-code-highlight\" data-id=\"98482f8\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp><script>let categoryUrl = '{{route('categories.index')}}'; <\/script><\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-88a1596 elementor-widget elementor-widget-text-editor\" data-id=\"88a1596\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Next steps, I&#8217;m going to listen to the click event of the delete button. one more thing does not forget to add the record id into the data attribute to the delete button. see the above image for it. I highlighted it with a yellow line.<\/p><p>So the general practices we use in Laravel is to write the following code to listen to a click event and delete a record,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1d09f15 elementor-widget elementor-widget-code-highlight\" data-id=\"1d09f15\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>$(document).on('click', '.delete-btn', function (event) {             \r\n           const id = $(event.currentTarget).data('id');\r\n\r\n  swal({ \r\n      title: 'Delete !',                     \r\n      text: 'Are you sure you want to delete this Category\" ?',                     \r\n      type: 'warning',                    \r\n      showCancelButton: true,                     \r\n      closeOnConfirm: false,                     \r\n      showLoaderOnConfirm: true,                     \r\n      confirmButtonColor: '#5cb85c',                     \r\n      cancelButtonColor: '#d33',                     \r\n      cancelButtonText: 'No',                     \r\n      confirmButtonText: 'Yes',                 },                 \r\n          function () {                    \r\n                   $.ajax({                 \r\n                       url: categoryUrl + '\/' + id,                 \r\n                       type: 'DELETE',                 \r\n                       DataType: 'json',                 \r\n                       data:{\"_token\": \"{{ csrf_token() }}\"},                 \r\n                       success: function(response){                     \r\n\r\n                              swal({                                 \r\n                                  title: 'Deleted!',                                 \r\n                                  text: 'Category has been deleted.',                                 \r\n                                  type: 'success',                                 \r\n                                  timer: 2000,                             \r\n                              });                     \r\n  $('#categoryTbl').DataTable().ajax.reload(null, false);                 \r\n              },                 \r\n               error: function(error){                     \r\n               swal({                                 \r\n                   title: 'Error!',                                 \r\n                   text: error.responseJSON.message,                                 \r\n                   type: 'error',                                 \r\n                   timer: 5000,                             \r\n              })                     \r\n            }             \r\n        });                 \r\n    });         \r\n});<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2736396 elementor-widget elementor-widget-text-editor\" data-id=\"2736396\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Now we are done with the front-end side and need to look into it backend side.<\/p><p>Let&#8217;s declare the destroy method into the category Controller. I hope are you generating crud with InfyOm Laravel Generator. so, the Destroy method and routes are there. If not please create a route. if the destroy method is there then need to change the response of that method.<\/p><p>The destroy method code looks like,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-35fad8a elementor-widget elementor-widget-code-highlight\" data-id=\"35fad8a\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript \">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp> public function destroy($id)     { \r\n        $category = $this->categoryRepository->find($id);\r\n        if (empty($category)) {\r\n            Flash::error('Category not found');\r\n\r\n            return $this->sendError('Category not found.');\r\n        }\r\n\r\n        $this->categoryRepository->delete($id);\r\n\r\n        return $this->sendSuccess('Category deleted successfully.');\r\n    }<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t\n    <div class=\"xs_social_share_widget xs_share_url after_content \t\tmain_content  wslu-style-1 wslu-share-box-shaped wslu-fill-colored wslu-none wslu-share-horizontal wslu-theme-font-no wslu-main_content\">\n\n\t\t\n        <ul>\n\t\t\t        <\/ul>\n    <\/div> \n","protected":false},"excerpt":{"rendered":"<p>We work on projects with the admin panel every day. In which we mostly use data tables and we need to delete the record&#8230;<\/p>\n","protected":false},"author":2,"featured_media":5322,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"postBodyCss":"","postBodyMargin":[],"postBodyPadding":[],"postBodyBackground":{"backgroundType":"classic","gradient":""},"two_page_speed":[],"footnotes":""},"categories":[9],"tags":[166,19],"class_list":["post-5320","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-ajax","tag-learning"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Delete Record using ajax call with Laravel<\/title>\n<meta name=\"description\" content=\"Guide for AJAX-based record deletion in Laravel, cover setup, route handling, CSRF protection, confirmation dialogs, and JSON responses.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Delete Record using ajax call with Laravel\" \/>\n<meta property=\"og:description\" content=\"Guide for AJAX-based record deletion in Laravel, cover setup, route handling, CSRF protection, confirmation dialogs, and JSON responses.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog | InfyOm Technologies\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/infyom\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-19T05:54:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-17T06:35:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png\" \/>\n\t<meta property=\"og:image:width\" content=\"772\" \/>\n\t<meta property=\"og:image:height\" content=\"484\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"InfyOm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InfyOm\" \/>\n<meta name=\"twitter:site\" content=\"@InfyOm\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InfyOm\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/\"},\"author\":{\"name\":\"InfyOm\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754\"},\"headline\":\"How to Delete Record using ajax call with Laravel\",\"datePublished\":\"2020-08-19T05:54:49+00:00\",\"dateModified\":\"2025-07-17T06:35:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/\"},\"wordCount\":298,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/infyom.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png\",\"keywords\":[\"Ajax\",\"Learning\"],\"articleSection\":[\"Laravel\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/\",\"url\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/\",\"name\":\"How to Delete Record using ajax call with Laravel\",\"isPartOf\":{\"@id\":\"https:\/\/infyom.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png\",\"datePublished\":\"2020-08-19T05:54:49+00:00\",\"dateModified\":\"2025-07-17T06:35:31+00:00\",\"description\":\"Guide for AJAX-based record deletion in Laravel, cover setup, route handling, CSRF protection, confirmation dialogs, and JSON responses.\",\"breadcrumb\":{\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#primaryimage\",\"url\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png\",\"contentUrl\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png\",\"width\":772,\"height\":484,\"caption\":\"How to Delete Record using ajax call with Laravel\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/infyom.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Delete Record using ajax call with Laravel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/infyom.com\/blog\/#website\",\"url\":\"https:\/\/infyom.com\/blog\/\",\"name\":\"Blog | InfyOm Technologies\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/infyom.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/infyom.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/infyom.com\/blog\/#organization\",\"name\":\"InfyOm Technologies\",\"url\":\"https:\/\/infyom.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png\",\"contentUrl\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png\",\"width\":88,\"height\":41,\"caption\":\"InfyOm Technologies\"},\"image\":{\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/infyom\",\"https:\/\/x.com\/InfyOm\",\"https:\/\/www.instagram.com\/infyomtechnologies\/\",\"https:\/\/in.linkedin.com\/company\/infyom-technologies\",\"https:\/\/github.com\/infyomlabs\",\"https:\/\/x.com\/infyom\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754\",\"name\":\"InfyOm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g\",\"caption\":\"InfyOm\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Delete Record using ajax call with Laravel","description":"Guide for AJAX-based record deletion in Laravel, cover setup, route handling, CSRF protection, confirmation dialogs, and JSON responses.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/","og_locale":"en_US","og_type":"article","og_title":"How to Delete Record using ajax call with Laravel","og_description":"Guide for AJAX-based record deletion in Laravel, cover setup, route handling, CSRF protection, confirmation dialogs, and JSON responses.","og_url":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/","og_site_name":"Blog | InfyOm Technologies","article_publisher":"https:\/\/www.facebook.com\/infyom","article_published_time":"2020-08-19T05:54:49+00:00","article_modified_time":"2025-07-17T06:35:31+00:00","og_image":[{"width":772,"height":484,"url":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png","type":"image\/png"}],"author":"InfyOm","twitter_card":"summary_large_image","twitter_creator":"@InfyOm","twitter_site":"@InfyOm","twitter_misc":{"Written by":"InfyOm","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#article","isPartOf":{"@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/"},"author":{"name":"InfyOm","@id":"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754"},"headline":"How to Delete Record using ajax call with Laravel","datePublished":"2020-08-19T05:54:49+00:00","dateModified":"2025-07-17T06:35:31+00:00","mainEntityOfPage":{"@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/"},"wordCount":298,"commentCount":0,"publisher":{"@id":"https:\/\/infyom.com\/blog\/#organization"},"image":{"@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#primaryimage"},"thumbnailUrl":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png","keywords":["Ajax","Learning"],"articleSection":["Laravel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/","url":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/","name":"How to Delete Record using ajax call with Laravel","isPartOf":{"@id":"https:\/\/infyom.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#primaryimage"},"image":{"@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#primaryimage"},"thumbnailUrl":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png","datePublished":"2020-08-19T05:54:49+00:00","dateModified":"2025-07-17T06:35:31+00:00","description":"Guide for AJAX-based record deletion in Laravel, cover setup, route handling, CSRF protection, confirmation dialogs, and JSON responses.","breadcrumb":{"@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#primaryimage","url":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png","contentUrl":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/08\/delete-record-using-ajax-in-laravel.png","width":772,"height":484,"caption":"How to Delete Record using ajax call with Laravel"},{"@type":"BreadcrumbList","@id":"https:\/\/infyom.com\/blog\/how-to-delete-record-using-ajax-in-laravel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/infyom.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Delete Record using ajax call with Laravel"}]},{"@type":"WebSite","@id":"https:\/\/infyom.com\/blog\/#website","url":"https:\/\/infyom.com\/blog\/","name":"Blog | InfyOm Technologies","description":"","publisher":{"@id":"https:\/\/infyom.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/infyom.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/infyom.com\/blog\/#organization","name":"InfyOm Technologies","url":"https:\/\/infyom.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png","contentUrl":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png","width":88,"height":41,"caption":"InfyOm Technologies"},"image":{"@id":"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/infyom","https:\/\/x.com\/InfyOm","https:\/\/www.instagram.com\/infyomtechnologies\/","https:\/\/in.linkedin.com\/company\/infyom-technologies","https:\/\/github.com\/infyomlabs","https:\/\/x.com\/infyom"]},{"@type":"Person","@id":"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754","name":"InfyOm","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/infyom.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g","caption":"InfyOm"}}]}},"_links":{"self":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts\/5320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/comments?post=5320"}],"version-history":[{"count":24,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts\/5320\/revisions"}],"predecessor-version":[{"id":8125,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts\/5320\/revisions\/8125"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/media\/5322"}],"wp:attachment":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/media?parent=5320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/categories?post=5320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/tags?post=5320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}