CRUD Laravel 5 how to link to destroy of Resource Controller?

后端 未结 10 2176
迷失自我
迷失自我 2020-12-15 17:27

I have a link



        
10条回答
  •  时光取名叫无心
    2020-12-15 18:19

    GET and DELETE Both routes have the same URL, but the header verb identifies which to call.

    Here are my code snippets for edit and delete. I use bootstrap modal confirmation for delete action

    BootStrap Modal

    And Finally JS code

    $('.formConfirm').on('click', function (e) {
      e.preventDefault();
      var el = $(this);
      var title = el.attr('data-title');
      var msg = el.attr('data-message');
      var dataForm = el.attr('data-form');
    
      $('#formConfirm')
        .find('#frm_body').html(msg)
        .end().find('#frm_title').html(title)
        .end().modal('show');
    
      $('#formConfirm').find('#frm_submit').attr('data-form', dataForm);
    });
    
    $('#formConfirm').on('click', '#frm_submit', function (e) {
      var id = $(this).attr('data-form');
      $(id).submit();
    });
    

提交回复
热议问题