DataTables server-side processing.
DataTables server-side processing.
Hello everyone,
I downloaded the example DataTables server-side processing.
When I use the table that is in the example (datatables_demo) works normally.
When I set up for one of my tables:
simple.html
<
table id = "example" class = "display" cellspacing = "0" width = "100%">
<thead>
<tr>
<th> Contrib </ th>
<th> protocolo </ th>
<th> assunto </ th>
<th> flag </ th>
</ tr>
</ thead>
<tfoot>
<tr>
<th> Contrib </ th>
<th> protocolo </ th>
<th> assunto </ th>
<th> flag </ th>
</ tr>
</ tfoot>
</ table>
server_processing.php
$ table = 'tbl_protocolos';
// Table's primary key
$ primaryKey = 'id_protocolo';
// Array of database columns Which Should be read and sent back to DataTables.
The parameter // db
Represents the column name in the database, while thedt
// Parameter Represents the DataTables column identifier. In this simple case
// indexes
$ columns = array (
array ('db' => 'id_contrib', 'dt' => 0),
array ('db' => 'protocolo', 'dt' => 1),
array ('db' => 'assunto', 'dt' => 2),
array ('db' => 'flag', 'dt' => 3),
);
the invalid JSON response "tn / 1" error occurs.
Can anyone tell me why ?
Answers
hey Alan, why MY TABLEe does not work, I can not understand why.?
i put the name - tbl_protocolos
i put ID - id_protocolo
I put the name of columns as my table - id_servidor, id_contrib, protocolo, assunto, id_setor, flag
iI put credences database.
what else should I do?
does not work just localhost, i dont know why.
i make upload for my server and work.
Doing some testing ....
Using the example table (datatables_demo) works on localhost and web server.
Using my table, works on the web server and NOT WORKS on localhost.
INVALID JSON Response.
Can anyone help me ??
so Alan, using xammp version 1.8.3 does not work.
xampp works fine for me.
You should show more of your code (formatted using Markdown).
hey tangerine, can you tell me your xampp version ?
Using the example table (datatables_demo) works on localhost and web server.
Using my table, works on the web server and NOT WORKS on localhost.
INVALID JSON Response.
why ???
I need help, something weird is happening.
I uploaded the plugin Datatables (http: //localhost/DataTables-1.10.2/examples/server_side/simplemylocal.html) and am trying to use the example server-side (DataTables-1.10.2 \ examples \ server_side \ simple. html)
Well, in the example found himself a mysql table datatables_demo (mysql.sql)
The problem:
setting the \scripts\server_processing.php datatables_demo to read the table, everything works perfectly, localhost and the web.
When set up with another table in my database, NOT localhost works, but works very well on the web.
The question is, why?
error: Datatables Warning: Invalid JSON response
I have to think that the problem is my table.
But if true, why it would work on the web?
so, I did some tests and find that the problem is in the words with accents, like á ão ç. How can I solve this?
SCRIPT
PHP
hey Alan, can you help-me ?
You need to read up on UTF-8. There are plenty of relevant posts in here for a start.
Tangerine,
$mysqli->query("SET NAMES 'utf8'");
$mysqli->query("SET character_set_connection=utf8");
$mysqli->query("SET character_set_client=utf8");
$mysqli->query("SET character_set_results=utf8");
I'm already using it on my connection
hey tangerine I got, but now, please look that:
http://stackoverflow.com/questions/26079486/return-value-on-button-datatable-server-side
can you help-me ?
Alan, maybe can you help me