Data from Ajax is successfully fetched, but are not displayed

Data from Ajax is successfully fetched, but are not displayed

sokvisal114sokvisal114 Posts: 1Questions: 1Answers: 0
edited May 3 in Free community support

Hi, so I am quite new to the datatable scene, and I was hoping if anybody can help me check out where I might've gone wrong.

My problem is, I sent a request to my controller (laravel) via ajax, and yajra datatable will serve a datatable's data right back, but it seems my fetch request went perfectly fine, and it even turned response with all the objects, but it doesn't get rendered in the table. I've been stuck with this for a good few days, and i would really appreciate it if anybody can help.

Link to test case:
Debugger code (debug.datatables.net): ohofoz
Error messages shown: No error message
Description of problem:
(I'm not sure what else i should provide, but I am more than happy to reply with any request)

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    "draw": 0,

    In the JSON response. It should never be 0, and that is why the table isn't drawing.

    From the server-side part of the manual:

    draw: The draw counter that this object is a response to - from the draw parameter sent as part of the data request. Note that it is strongly recommended for security reasons that you cast this parameter to an integer, rather than simply echoing back to the client what it sent in the draw parameter, in order to prevent Cross Site Scripting (XSS) attacks.

    Allan

Sign In or Register to comment.