Laravel delete button with HTML form

前端 未结 4 1082
[愿得一人]
[愿得一人] 2021-01-06 10:01

I\'m using the HTML form, not Laravel Collective.

For now I\'ve successfully created a CRUD for a users in my CMS, but one thing bothers me:

How can I set a

4条回答
  •  自闭症患者
    2021-01-06 10:23

    As you have stated it will be nice when a user clicks on the Delete button to show up confirmation popup for deleting the specific user. For this you have to use jquery and ajax. Change the following code:

    Delete
    

    to

    Delete
    

    and put an event listener like:

    $('.delete_user').click(function(){
      if( confirm('Are you sure?') )
      {
        var id = $(this).attr('id');
        // Make an ajax call to delete the record and pass the id to identify the record
      }
    });
    

提交回复
热议问题