Example - Server Side - Not Working

Example - Server Side - Not Working

justforlookingjustforlooking Posts: 2Questions: 0Answers: 0
edited June 2012 in General
Hey all-

Can anyone give me a hand trying to figure out why the example documentation server_side.html isn't working. I've changed the server_side.html and the server_processing.php files to match my database schema... but I'm getting a json parsing error. "DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error."

http://debug.datatables.net/uviwov

Thank you in advance for looking at this!

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    This is what is coming back from your server:

    [code]
    ArrayArrayArrayArrayArrayArrayArrayArrayArrayArray {
    "sEcho": 1,
    "iTotalRecords": "383",
    "iTotalDisplayRecords": "383",
    "aaData": [
    ["365", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"],
    ["366", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"],
    ["367", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"],
    ["368", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"],
    ["369", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"],
    ["370", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"],
    ["371", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"],
    ["372", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"],
    ["373", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"],
    ["374", "Checkbox", "DONOTUSE1", "", "", "", "Unknown Use", "Unknown Use", "0"]
    ]
    }
    [/code]

    so the warning is correct - it is invalid JSON.

    Allan
  • justforlookingjustforlooking Posts: 2Questions: 0Answers: 0
    I'm not really that familiar with JSON yet, I'm still studying it. I'm assuming the invalid part is the ArrayArrayArray... The aaData is correct data coming from my table.

    I'm using the examples provided in the download. I would assume those are working examples, but maybe not? Can you point me in the right direction for fixing this?

    Thanks for the feedback Allan.
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    You are correct that the 'Array' part makes it invalid.

    There is something in the code you are using that is echoing that out for whatever reason. Given that there are 10 instances of the string 'Array' I would suggest that there is something in the loop for processing each row that is echoing that out for whatever reason. There shouldn't be anything in the examples that does that.

    Allan
This discussion has been closed.