2017-04-01 10:10
浏览 77

使用bootstrap动态模态进行删除确认(laravel blade)

My goal is to use bootstrap modal as delete confirmation. But the problem is I need to transfer a dynamic variable (which contains item ID) value to bootstrap modal for submit post request to delete that specific item.
Please check Modal Part where value="foo" is set now tell me how can I make this "foo" as dynamic variable which will be coming from laravel blade template part ("<td><a href="{{'#'}}" data-toggle="modal" data-target="#myModal">Delete</a></td>") Whats the solution? I prefer javascript solution.

Bootstrap Modal Part

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Are you sure?</h4>
                <form method="post">
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <button type="submit" class="btn btn-primary" name="delete_dividend" value="foo">Delete</button>

Laravel Blade Template Part

@foreach($dividends_10 as $_dividend_data)
                      <td><a href="{{'dividends'}}">Edit</a></td>
                      <td><a href="{{'#'}}" data-toggle="modal" data-target="#myModal">Delete</a></td>
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题