Laravel yajra datatable: cannot retrieve the search parameter from ajax call in controller

后端 未结 1 1389
粉色の甜心
粉色の甜心 2020-12-12 07:36

I am trying to build a dataTable with custom filtering with the help of yajra datatable from here :

HTML table in view :

  
相关标签:
1条回答
  • 2020-12-12 08:13

    Looks like the ? in the Route is not used to define an optional parameter but a string instead:

    Route::get('exams/student/get-exam-attempts/{user_slug}/{exam_slug?}', 'StudentQuizController@getExamAttemptsData');
    

    Could you please change it and see what you get?

    Route::get('exams/student/get-exam-attempts/{user_slug}/{exam_slug}', 'StudentQuizController@getExamAttemptsData');
    

    Also, the query string you posted has a space after myyser123, this could also explain the issue.

    http:// localhost/lcbs/exams/student/get-exam-attempts/myuser123 ?draw=2&columns%5B0%5D%5Bdata%5D=0......search%5Bregex%5D=false&batch=22&_=1541684388689.
    

    So I would suggest to check how the value is defined in the javascript code

    url: '{{ $routeValue }}',
    
    0 讨论(0)
提交回复
热议问题