Ajax url reload

Ajax url reload

eaudeteaudet Posts: 2Questions: 1Answers: 0

Hi,

I am following this section: http://datatables.net/reference/api/ajax.url().load()

It does not work. It load my table the first time but the setInterval as no effect.

<script type="text/javascript" charset="utf-8">
    function updateTable() {
        var oTable = $('#userStats').dataTable({
            "processing" : true,
            "ajax" : {
                "url" : "/RealTimeAnalytics/ScreenersAudit",
                "dataSrc" : "stats",
                "type" : "GET"
            }
        });

        setInterval(function() {
            oTable.ajax.url('/RealTimeAnalytics/ScreenersAudit').load();
        }, 3000);
    }
</script>

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,262Questions: 1Answers: 10,423 Site admin

    var oTable = $('#userStats').dataTable({

    Top FAQ :-)

    Allan

  • eaudeteaudet Posts: 2Questions: 1Answers: 0

    Thanks for reminding me that RTFMYFM still is a good thing to do ;-)
    I would suggest to all DataTable beginners to rely ob the DataTable API documentation and not search for a quick an dirty example on some blogger's site. In my case, I used an example from version 9 and was trying use the 10 api...it is a bit confusing.

  • allanallan Posts: 63,262Questions: 1Answers: 10,423 Site admin
    Answer ✓

    I probably made a mistake using only a capital letter to distinguish between the two. Should have used dataTableApi() perhaps... Too late now :-)

    Allan

This discussion has been closed.