PHP can echo all data, but Ajax only get empty array
PHP can echo all data, but Ajax only get empty array
So iam using Datatables for 6000 row from database. I'm using SSP CLASS to use the serverside program.
if I'm open the PHP file that echoing the JSON_ENCODE data, it will print out all data from database. But when I'm calling the data with ajax for showing it with Datatables, its only show empty row, and I'm trying to console.log the data, its empty array, what should I do? because datatables is not providing me an error message here
This question has an accepted answers - jump to answer
Answers
I'm not too clear what the problem is, I'm afraid. For us to help, please can you link to your page, or at the least post your code here so we can take a look,
Colin
im sorry colin, i will give you screenshot about this
-> datatables
-> PHP file that accessing the data using ssp class
Colin said
Your screenshot doesn't help.
i cannot give you access to the page, but the code for table:
and the ajax PHP file:
Everything looks OK, try removing the
type:"POST"
,Colin
Hello colin, when i remove the
type: "POST"
, it give me warningInvalid JSON response
What is the response from the server in that case? The error message should have pointed you to this tech note which explains how you can get that information.
Also, can you post the
type:"POST"
back, since that it what you are using for yourSSP::simple( $_POST, ...)
call.Finally, since you can't provide a link, can you use the debugger to give me a trace please - click the Upload button and then let me know what the debug code is.
Allan
Sorry guys, turns out the data from database is empty all along, I'm soo sorry for wasting your time guys.. you can delete this post Admin