reuse ajax source for multiple tables on the same page

reuse ajax source for multiple tables on the same page

SchnaafSchnaaf Posts: 2Questions: 1Answers: 0

Hi,

First of all happy new year and WOW WHAT A GREAT MODULE!

I'm using datatables with ajax. I have multiple datatables on the same page displaying data from the same data source. How can I prevent requesting the exact same ajax data source multiple times?

Test case: http://live.datatables.net/yiluxude/1/edit

In this case http://live.datatables.net/examples/ajax/data/objects.txt is requested three times, once for every table. How can I make it request the data source only once and reuse this in all three datatables?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Answer ✓

    Hi,

    Happy New Year.

    How can I prevent requesting the exact same ajax data source multiple times?

    What I would suggest is that you make the Ajax call to get the data yourself using $.ajax() and then use the data option, or rows.add() method, to add the data tot he tables.

    Allan

  • SchnaafSchnaaf Posts: 2Questions: 1Answers: 0

    Thanks that did the trick

This discussion has been closed.