Invalid JSON response: ASP.net & SQL database

Invalid JSON response: ASP.net & SQL database

wkhorwkhor Posts: 3Questions: 2Answers: 0

I have a SQL server database with just 1 table (Company).
I need to fill load it into datatable and has been following the example - server side processing.
I had managed to create an aspx and also asmx to generate JSON as below

{"Company":1,"recordsTotal":5,"recordsFiltered":5,"data":[["Mgr","Romanos "],["Barge","Store "],["Bar","Bougie "],["Dunn","Mick "],["TD","1 "]]}

But I just can't figure out how to get the JSON loaded into the datatable.

<script type="text/javascript">
    $(document).ready(function() {
        $('#example').DataTable( {
            "processing": true,
            "serverSide": true,
            "ajax": "getdata.aspx"
        } );
    } );
</script>

Just wondering are there anything that I missed. I had tried using putting the JSON into a text file and it loaded up successfully but not when running as a server side processing. Would appreciate any help with this. Thanks!

Answers

  • allanallan Posts: 64,357Questions: 1Answers: 10,626 Site admin

    Could you run the debugger on your page please, or give a link to the page. That error suggests there is something other than the JSON data shown above which is making the response invalid JSON.

    Thanks,
    Allan

This discussion has been closed.