Laravel Table Сортируемый Обновление позиций - PullRequest
0 голосов
/ 07 ноября 2018

Я пытаюсь реализовать сортировку с помощью Jquery для моей таблицы, но когда я пытаюсь получить данные, я ничего не получаю, когда я console.log данных.

Вот мой стол:

<table id="players" name="players" class="table table-striped">
    <thead>
    <tr>
        <th>N°</th>
        <th>Nom</th>
        <th>Prénom</th>
        <th>N° licence</th>
    </tr>
    </thead>
    <tbody id="sortable">
    @if($joueurs->count())
        @foreach($joueurs as $joueur)
            <tr>
                <th id="{{$joueur->id}}">{{$joueur->position}}</th>
                <th>{{$joueur->id}} -  {{$joueur->licencie->lb_nom}}</th>
                <th>{{$joueur->licencie->lb_prenom}}</th>
                <th>{{$joueur->licencie->num_licence}}</th>
            </tr>
        @endforeach
    </tbody>
</table>

Вот мой сценарий:

   $(document).ready(function () {
                $('#sortable').sortable({
                    axis: 'y',
                    update: function (event, ui) {
                        var data = $(this).sortable("serialize");
                        console.log(data);
                    $.ajax({
                        data: data,
                        type: 'POST',
                        url: '../save-order'
                    });
                    }
                });
            });
...