Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81687

Server-side processing with SESSION check makes JSON error

$
0
0
Hello,

first of all I can't provide url for the website, because it's company development website with sensitive data.

I'm building a website with datatables table using server-side processing of the table. I'm using the default PHP code for the processing - just a bit modified for SESSION check on the top
http://www.datatables.net/development/server-side/php_mysql

+
session_start();
session_regenerate_id(true);
if(!isset($_SESSION['login']) || $_SESSION['UA'] != $_SERVER['HTTP_USER_AGENT'] || time() - $_SESSION['timeout']>=600){
session_unset();
session_destroy();
header('Location:index.php');
}else{
$_SESSION['timeout'] = time();

But what I noticed is when I'm using search provided by dataTables, sometimes when I type fast, I suddenly get an error:

DataTables warning (table id = 'example'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error

What I imagine is happing, that another request is made before SESSION check is completed and recieving incorrect data from the script. Am I assuming right? Is there any way how to deal with this problem?

Thank you very much.

Viewing all articles
Browse latest Browse all 81687

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>