Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This is the JSON response I'm getting. Javascript alert says JSON error and couldn't to be parsed! I'm confused as to what causes this problem.

{"sEcho":1,"iTotalRecords":"4","iTotalDisplayRecords":"4","aaData":[["59","474","1838937873"],  
["60","520","1838937873"],["61","520","100004515813901"],["62","474","0"]]}              

Array
(
   [sEcho] => 1
   [iTotalRecords] => 4
   [iTotalDisplayRecords] => 4
  [aaData] => Array
    (
        [0] => Array
            (
                [0] => 59
                [1] => 474
                [2] => 1838937873
            )

        [1] => Array
            (
                [0] => 60
                [1] => 520
                [2] => 1838937873
            )

        [2] => Array
            (
                [0] => 61
                [1] => 520
                [2] => 100004515813901
            )

        [3] => Array
            (
                [0] => 62
                [1] => 474
                [2] => 0
            )

    )

)

This is the Script I'm using in HTML page

<script type="text/javascript" charset="utf-8">

        $(document).ready(function() {
            var oTable = $('#example').dataTable( {
                "bProcessing": true,
                "bServerSide": true,
                "sAjaxSource": "server_processing.php",
                "aoColumns": [
                    { "mData": "id" },
                    { "mData": "cab_id" },
                    { "mData": "user_id" }


                ]
            } );
        } );
    </script>
share|improve this question
    
have you tries jsonlint.com to validate your json –  Ahsan Shah Sep 26 '13 at 4:03
    
The above json is a valid json. Check your dataTable plugin version. –  Saranya Sadhasivam Sep 26 '13 at 4:05
    
json seems to be ok. how you are parsing? –  Ahsan Shah Sep 26 '13 at 4:07
    
Will I get the result in my table with the given Script? –  Jojo George Sep 26 '13 at 4:16
    
@SaranyaSadhasivam : version 1.9.4 –  Jojo George Sep 26 '13 at 4:23
show 7 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.