server_side problems

server_side problems

glenngvzglenngvz Posts: 3Questions: 0Answers: 0
edited July 2009 in General
I cannot get the server_side.html example to function.
The string echoed by server_processing.php is:
{"sEcho": , "iTotalRecords": 1, "iTotalDisplayRecords": 1, "aaData": [ ["Roger","Rabbit","348957347","8934758934","roger@rabbit.com"]] }

However, the server_side.html just displays "processing..." and does not show this record.
All of the other static examples work.
Could someone assist please?

Replies

  • glenngvzglenngvz Posts: 3Questions: 0Answers: 0
    edited July 2009
    Some further information, there is no problem with the json, I used the same server_processing as a source in data_sources/ajax.html and it worked perfectly. The problem is with the server_side.html file.
    I altered it so it pulled multiple records from the database, and it displayed perfectly with the ajax.html code.
    The problem is when you add "bServerSide": true to the javascript.
  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi glenngvz,

    Actually the problem is quite certainly with the JSON being passed back (try running it through www.jsonlint.com for example). The sEcho parameter in the object has no value - which will cause the parsing to fail. So two thing come to mind:

    1. Are you using DataTables 1.5 beta 11?
    2. Are you correctly echoing sEcho back?

    Regards,
    Allan
  • glenngvzglenngvz Posts: 3Questions: 0Answers: 0
    edited July 2009
    Hi Allan,

    No idea why sEcho is blank, probably the reason why it is failing.
    I am using DataTables 1.5 beta 11 downloaded today.
    How is sEcho passed? what should it be?
    No other changes to the script were made at all.
    Passed it through jasonlint, sEcho is the problem. Is is as a get_value, yet nothing seems to be sent to the script from the html file

    Thanks,

    Glenn
  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi Glenn,

    sEcho is GET parameter send by DataTables along with all the other parameters needed for reading the data base and it just needs to be echoed back (hence the name :-) ). Something like 'echo $_GET['sEcho'];' for example.

    You might want to check that the parameter is being send to the server (using Firebug etc) and that the server code you have is passing it back.

    Regards,
    Allan
This discussion has been closed.