lundi 5 février 2018

Laravel Datatables get data from GET variables

Laravel 5.5

I have a search view where users can type in the text input fields to search a table. The request goes to GET variables onto the results blade.

Inside the results blade, there is a Laravel ajax table.

I can't figure out how to get pass the GET variables in the URL to the search Laravel ajax request.

Ultimately, I want to be able to pass $_GET lead_name, lead_phone, etc to this ajax request. How can I accomplish that?

Here is my datatables script at the bottom of the page:

<script>
$(function() {
    $('.datatable').DataTable({
        processing: true,
        serverSide: true,
        ajax: '',
        columns: [
            { data: 'lead_name', name: 'leads.lead_name' },
            { data: 'lead_merchant_id', name: 'leads.lead_merchant_id'},
            { data: 'lead_address_city', name: 'leads.lead_address_city' },
            { data: 'lead_address_state', name: 'leads.lead_address_state' },
            { data: 'accountstatus_description', name: 'accountstatus.accountstatus_description' },
            { data: 'firstlast_name', name: 'name' }
        ],
        rowReorder: {
            selector: 'td:nth-child(0)' 
           },
        responsive: true
    });
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire