invalid json but is valid

invalid json but is valid

LicassLicass Posts: 6Questions: 2Answers: 0

json is valid but always get an error. Need help. thanks

{"data":[{"RHID":"1","NOME":"Leon11 7676676754654","NOME_REDZ":"Matias testes111144 9977","EMAIL":"ddd@ii.ll","EMAIL_PESSOAL":null,"TELEMOVEL_1":"(564) 564 564 654","TELEMOVEL_2":"","SEXO":"F"},{"RHID":"2","NOME":"Leon11 7676676754654","NOME_REDZ":"Matias testesertrreerewqr","EMAIL":"leonor.ribeiro@demo.pt","EMAIL_PESSOAL":"leonor.ribeiro@gmail.pt","TELEMOVEL_1":"(121) 111 111 111","TELEMOVEL_2":null,"SEXO":"M"},{"RHID":"3","NOME":"Leon11 7676676754654","NOME_REDZ":"Matias t33 uyyu 6654455","EMAIL":"jose.infante@demo.pt","EMAIL_PESSOAL":"jose_infante@gmail.com","TELEMOVEL_1":"(351) 936 090 982","TELEMOVEL_2":"936909871","SEXO":"M"},{"RHID":"4","NOME":"Leon11 7676676754654 6565 4343","NOME_REDZ":"Matias 5588 54445","EMAIL":"rosa.castanho@demo.pt","EMAIL_PESSOAL":"","TELEMOVEL_1":"(546) 666 666 666","TELEMOVEL_2":"","SEXO":"F"},{"RHID":"5","NOME":"Leon11 7676676754654","NOME_REDZ":"Matias testes543534 7777","EMAIL":"francisco.oliveira@demo.pt","EMAIL_PESSOAL":"","TELEMOVEL_1":"(546) 546 455 446","TELEMOVEL_2":"","SEXO":"M"}],"total_Records":"143"}

Answers

  • allanallan Posts: 63,353Questions: 1Answers: 10,444 Site admin

    Please link to a test case showing the issue, per the forum rules.

    Allan

  • allanallan Posts: 63,353Questions: 1Answers: 10,444 Site admin

    It isn't JSON coming back at all - it looks like HTML. This is the debug trace: http://debug.datatables.net/udugec .

    Click the "Tables" button at the top and then the "Server interaction" option. That is what the server is returning. You can also see the same if you use the network tools in your browser.

    The DataTable options doesn't appear to have an ajax option set.

    Allan

  • LicassLicass Posts: 6Questions: 2Answers: 0

    $('#quadTable').dataTable({
    //paging: false,
    //scrollY: 400,
    "serverSide": true,
    "responsive": true,
    "stateSave": true, //Saves (from previous interaction) paging position, ordering state etc
    "data": QuadTable.getData(),

    and getData:

    dados=this.sqlData = {
    "dbTable": this.table
    , "dbAlias": "A1"
    , "dbOperation": "SELECT"
    , "dbColunas": this.dbColumns
    , "dbWhere": this.whereQry
    };
    $.ajax({
    type: "POST"
    ,
    url: "/QUAD_HCM/data-source/" + obj.sqlFile
    ,
    data: {
    pk: obj.pk.primary,
    operacao: 'SELECT',
    columnsArray: JSON.stringify(dados),
    table: obj.table,
    maxRecords: maxRecords,
    startIn: startIn
    }
    ,
    cache: false
    ,
    async: false

  • LicassLicass Posts: 6Questions: 2Answers: 0
    edited February 2016

    {"data":[{"RHID":"1","NOME":"\u00c1lvaro Rodrigues de Freitas 54","NOME_REDZ":"\u00c1lvaro Lobo Freitas leo 2","EMAIL":"alvaro.freitas@demo.pt","EMAIL_PESSOAL":"alvaro.freitas@gmail.com","TELEMOVEL_1":"(212) 122 345 678","TELEMOVEL_2":"","SEXO":"M"},{"RHID":"2","NOME":"Leonor Santos Freitas da Costa Ribeiro teste","NOME_REDZ":"Leonor F. C. Ribeiro 6","EMAIL":"leonor.ribeiro@demo.pt","EMAIL_PESSOAL":"leonor.ribeiro@gmail.pt","TELEMOVEL_1":"(121) 111 111 111","TELEMOVEL_2":null,"SEXO":"M"},{"RHID":"3","NOME":"Jos\u00e9 Guilherme Alves Infante Gra\u00e7as","NOME_REDZ":"Jos\u00e9 Alves Gra\u00e7a leo","EMAIL":"jose.infante@demo.pt","EMAIL_PESSOAL":"jose_infante@gmail.com","TELEMOVEL_1":"(351) 936 090 982","TELEMOVEL_2":"936909871","SEXO":"M"},{"RHID":"4","NOME":"Rosa Maria Miranda Castanho testes","NOME_REDZ":"Rosa Castanho43","EMAIL":"rosa.castanho@demo.pt","EMAIL_PESSOAL":"","TELEMOVEL_1":"(345) 345 435 345","TELEMOVEL_2":"","SEXO":"M"},{"RHID":"5","NOME":"Francisco Manuel Fernandes Alvarez Oliveira kkkpp","NOME_REDZ":"Francisco Oliveira uu","EMAIL":"francisco.oliveira@demo.pt","EMAIL_PESSOAL":"","TELEMOVEL_1":"(456) 465 465 646","TELEMOVEL_2":"","SEXO":"F"}],"total_Records":"45"}

  • allanallan Posts: 63,353Questions: 1Answers: 10,444 Site admin

    I'm not entirely sure what to do with the above information. As I say, and as you can see using the debugging tools in your browser, the Ajax request DataTables is making has HTML returned to it. That appears to be because there is no ajax option specified in the initialisation, thus it has no idea where to get the data from (and in turn it requests the current page).

    Allan

This discussion has been closed.