php – Show datepicker in jQuery and results in DataTable that do not work in the Laravel app

I use Laravel 5.4 and start using [Date Range Picker] If Dan Grossman1 selects two dates, a request from Ajax will get the answer later with the results displayed in Yajra DataTable.

The Ajax site works fine, I'm already testing it and it works fine. But now my problem starts after using Datepicker, where the results are displayed correctly for the first time and looks like, but if I select a date and then click on "Search", then click on "Search". The same data is kept, which means that Ajax does not work with new can I know the reason and the cause of the problem, so that the data sent by the AJAX inquiry work well.

HTML source code:


& nbsp;



Jquery code:

$ (Document) .ready (Function () {


$ (Function () {

var start = moment (). subtract (15, & days #);
var end = moment ();

Function cb (start, end) {
$ (# Reportrange span & # 39;). html (start.format (# MMMM D, YYYY)) + # - # + end.format (# MMMM D, YYYY)));

}

$ (# Reportrange & # 39;). dater picker ({
startDate: start,
endDate: end,
Areas: {
& # 39; Today & # 39 ;: [moment(), moment()],
& # 39; Yesterday & # 39 ;: [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
& # 39; last 7 days & # 39 ;: [moment().subtract(6, 'days'), moment()],
& # 39; Last 30 days & # 39 ;: [moment().subtract(29, 'days'), moment()],
& # 39; this month & # 39 ;: [moment().startOf('month'), moment().endOf('month')],
& # 39; Last month & # 39 ;: [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
            }
}, cb);

cb (start, end);
// alert (start.format (# YYYY-M-DD hh: mm: ss)) + end.format (# YYYY-M-DD hh: mm: ss & # 39;)) ;


var allUsersTable = $ (& # 39; allleads & # 39;). DataTable ({
Processing: true,
ServerSide: true,
// "bSort": false,
Ajax: {
url: "{{url (& # 39; lead / GetAllLeads & # 39;}}}",
Data: Function (d) {
d.level = $ (# level filter #). val ()
d.start_time = start.format (& # 39; YYYY-M-DD hh: mm: ss & # 39;),
d.end_time = end.format (& # 39; YYYY-M-DD hh: mm: ss & # 39;
}
},
{{- "ajax": "{{url (& lead; GetAllLeads & # 39;}}}, -}}
// "data": level = $ (# level filter #). val ()
Columns: [
                {"data": "lead", "name": "lead"},
                {"data": "email", "name": "email"},
                {"data": "primary_number", "name": "primary_number"},
                {"data": "show", "name": "show", orderable: false, searchable: false},
                {"data": "lead_type", "name": "lead_type"},
                {"data": "stage", "name": "stage"},
                {"data": "source_id", "name": "source_id"},
                {"data": "status", "name": "status", orderable: false, searchable: false},
                {"data": "sms", "name": "sms", orderable: false, searchable: false},
                {"data": "assign", "name": "assign", orderable: false, searchable: false},
                {"data": "note", "name": "note", orderable: false, searchable: false}
            ],
dom: & # 39; bfrtip & # 39 ;,
keys: [
                'copy', 'csv', 'excel', 'pdf', 'print'
            ]
        });


$ ("# search_leads"). click (function () {
allUsersTable.draw ();
});


});

`