Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72358

Datatable not updated where clause

$
0
0

My datatable is not updating for query with a where clause. Query is retrieving the data according to query, but the datatable not update for the query result. I'm using laravel 5.8 with yajrav datatable package. Ajax success got correct jason values.

My ajax request:

$(document).on('click', '#btnShowToday', function(e) {
  e.preventDefault();

  let currentDate = $('#datepicker').val()

  $.ajax({
      type: "get",
      url: '/currentDateAppointment',
      data: {
        currentDate: currentDate
      }
    })
    .done(function(res) {
      console.log(res);
    })
    .fail(function(error) {
      console.log(error);
    });
})

My Controller method:

    public function currentDateAppointments(Request $request)
    {
        $date = $request->get('currentDate');

        $getData = DB::table('customers')
        ->join('jobs', 'jobs.id', '=', 'customers.id')
        ->select('jobs.id', 'firstname', 'lastname', 'vehiclemodel', 'date', 'time', 'payment_status', 'amount')
        ->where('date', '=', $date)
        ->get();

        $datatable = DataTables::of($getData)->make(true);
        return $datatable;
    }

why the datatable not showing the query result? ajax.reload() or draw() functions are not working. how to fix this? thank you.


Viewing all articles
Browse latest Browse all 72358

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>