mercredi 23 janvier 2019

Laravel error Unauthenticated when passing Datatable from view to controller

Hello i'm trying to pass Datatable from view to my controller. Here is my Datatable code in view :

<div class="table-responsive">
        <table id="example1" class="table table-bordered table-hover display">
                 <thead>
                       <tr>
                            <th><input type="checkbox" name="select_all" value="1" id="example-select-all"></th>
                             <th>No</th>
                             <th>Id</th>
                             <th>Exemplar</th>
                             <th width="40%">Title</th>
                       </tr>
                    </thead>
                    <tbody id="bookTable">
                    </tbody>
        </table></div>

And here is my javascript code :

$('#printLabel').click(function(e){
                e.preventDefault();
                 $.post("", 
                 //$('#searchForm').serialize())
                 table1.$('input,select,textarea').serialize())
                            .fail(function(data) {
                                alert(data.responseJSON.error);
                            });

                });

The codes above gave me error : {error: "Unauthenticated."}. Also, i'm not sure if "table1.$('input,select,textarea').serialize())" is the right why to pass datatable to controller.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire