How to use sweet alert for delete confirm in Codeigniter?

Today, We want to share with you how to use sweet alert in codeigniter.In this post we will show you sweet alert delete confirmation, hear for sweet alert delete confirm codeigniter we will give you demo and example for implement.In this post, we will learn about Laravel Sweet Alert AJAX CRUD Tutorial with an example.

How to use sweet alert for delete confirm in Codeigniter?

Step 1: Create products Table

CREATE TABLE IF NOT EXISTS `products` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `post_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `article_info` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=16 ;

Step 2: Add Routes

application/config/routes.php


Step 3: Create ProductController Controller

application/controllers/ProductController.php

load->database();
   }


   /**
    * Create from display on this method.
    *
    * @return Response
   */
   public function index()
   {
      $data['data'] = $this->db->get("products")->result();
      $this->load->view('productlist', $data);
   }


   /**
    * Delete Data from this method.
    *
    * @return Response
   */
   public function delete($id)
   {
       $this->db->delete('products', array('id' => $id));
       echo 'Deleted successfully.';
   }
}

Step 4: Create View Files

application/views/productlist.php




    How to use sweet alert for delete confirm in Codeigniter? - www.pakainfo.com
    
    
    
    


How to use sweet alert for delete confirm in Codeigniter? - www.pakainfo.com

Title Product Information Action
post_name; ?> article_info; ?>

I hope you get an idea about Creating Nice Alerts with sweetAlert.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment