【问题标题】:Use common edit/delete buttons in index page在索引页面中使用常用的编辑/删除按钮
【发布时间】:2017-06-08 15:12:18
【问题描述】:

我知道如何创建项目的索引列表并为每一行显示一个编辑/删除/等按钮。我一直在寻找一种对所有行使用单个编辑/删除/等按钮的方法。

让我解释一下。我想在我的索引页面右侧有一系列按钮,可以显示我的编辑、删除。等,按钮。然后,我将使用位于每行前面的复选框来选择我希望编辑/删除等的记录,并将此选中的值传递给按钮和控制器。

不确定这是否有意义。 index page

我想消除每一行的重复、编辑和删除按钮,并使用右侧的按钮。

任何帮助将不胜感激。 谢谢

【问题讨论】:

    标签: laravel laravel-5.2


    【解决方案1】:

    为了实现这一点,我建议使用 JQUERY 发送 ajax 帖子。 这看起来像是我会做的事情。

    function deleteData() {
    var id_delete = $('input[name="yourRadioButton"]:checked').val();
    $.ajax({
        url: "{{route('routeUrlHere')}}",
        type: 'POST',
        dataType: 'JSON',
        data: {
            _token : "{{Session::token()}}",
            id_delete: id_delete
        }
    })
    .success(function (response) {
        console.log(response);
        // Continue Jquery here
    
    })
    .error(function (xhr, status, response) {
        console.log(xhr.responseText);
    });
    
    }
    

    【讨论】:

      猜你喜欢
      • 2019-11-01
      • 2016-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-20
      • 1970-01-01
      相关资源
      最近更新 更多