Stuck on Processing
Stuck on Processing
Hey all I'm back .. I keep getting a error with sEcho being undefined and not displaying anything in my tables.
This keeps getting stuck on processing but I used JSONLint to check if my JSON is valid and this came up as true. I'm unsure what I may be doing wrong here?
I've recived help for the coding from a previous user but I think this is my final hurdle? Hope someone can help!
Thanks!
This keeps getting stuck on processing but I used JSONLint to check if my JSON is valid and this came up as true. I'm unsure what I may be doing wrong here?
I've recived help for the coding from a previous user but I think this is my final hurdle? Hope someone can help!
Thanks!
This discussion has been closed.
Replies
I think its because your not returning sEcho in the JSON. When datatables sends a request to your server it sends sEcho, you need to send this back with the JSON.
[code]
$data = array(
'sEcho' => intval($_GET['sEcho']),
.... // the rest of your array returned
);
echo json_encode($data);
[/code]
I've entered the echo statement that you've posted above and nothing changed on my screen still coming up as processing ..
I then went into Inspect Element > Network > XHR;
Double clicked on the file linked and the following can be seen for the sEcho;
{"sEcho":0,"iTotalRecords":"3","iTotalDisplayRecords":"3","aaData":[]}{"sEcho":0,"iTotalRecords":"3","iTotalDisplayRecords":"3","aaData":[["13","2012-11-01 16:52:01","6","satnav","3","15","Cool"],["14","2012-11-01 17:16:22","6","sata","3","104234324","7"],["15","2012-11-02 17:43:16","2","GPS","231","15111989",""]]}
sEcho should never ever be zero. See: http://datatables.net/usage/server-side
Allan
> An unaltered copy of sEcho sent from the client side. This parameter will change with each draw (it is basically a draw count) - so it is important that this is implemented. Note that it strongly recommended for security reasons that you 'cast' this parameter to an integer in order to prevent Cross Site Scripting (XSS) attacks.
Allan
I thought you had this solved y'day. Do you still have a problem??