Error : Cannot read property 'length' of undefined

Error : Cannot read property 'length' of undefined

JosephSongJosephSong Posts: 3Questions: 2Answers: 0

I'm using an ajax request to receive json:
{
"sold_to":"dummy_1",
"end_user_id":"end_user_id_test",
"_app_name":"dummy_3",
"_app_component":"dummy_4",
"expiration_date":"2014-10-27T17:58:45.690Z",
"id":null,
"license_key":"dummy_5",
"mobile_app_users":[
"one",
"two",
"three"
],
"start_date":"2014-10-27T17:58:45.690Z",
"time_last_heartbeat":"2014-10-26T17:58:45.690Z"
}

My javascript code:
$(document).ready( function () {
$('#table_id').DataTable({

    "ajax": {
        "url": "/license_read",
        "type": "GET",

}
});

});

I've looked at similar questions posted, but none of the solutions i could find helped.

Answers

  • anjibmananjibman Posts: 115Questions: 10Answers: 0

    Need some more code on what you are doing with the result.

  • JosephSongJosephSong Posts: 3Questions: 2Answers: 0

    $(document).ready( function () {
    $('#table_id').DataTable({
    //"ajax": "ajax.text",
    "ajax": {
    "url": "/license_read",
    "type": "GET"
    }
    });
    });

    According to the docs this code should populate the database, but it gives me an invalid json error

This discussion has been closed.