Get the data received via ajax request

Get the data received via ajax request

rrkumarrrkumar Posts: 4Questions: 1Answers: 0

Hi,

I need to get the data that was returned for the request made by data tables to get ajax sourced data.
I looked through the DOM and through the example but could not figure it out.
Can some one please tell me how can I get, the data that was received using the following piece of code?

$('#example').dataTable( {
"ajax": '../ajax/data/arrays.txt'
} );

Thanks.

Answers

  • rrkumarrrkumar Posts: 4Questions: 1Answers: 0

    Thanks everyone. I got the answer. Here it is in case someone needs it in future.

    $('#example').dataTable( {
    "ajax": '../ajax/data/arrays.txt',
    "initComplete": function( settings, json ) {
    console.log(json);
    } } );

  • allanallan Posts: 61,853Questions: 1Answers: 10,134 Site admin

    Exactly that - initComplete is the way to do it. You can also use ajax.json() after the data has been loaded if you need it in future.

    Allan

  • rrkumarrrkumar Posts: 4Questions: 1Answers: 0

    Thanks allan.

This discussion has been closed.