Waiting for ajax to return data before saying "no records"

Waiting for ajax to return data before saying "no records"

birdy247birdy247 Posts: 1Questions: 1Answers: 0

Hi

I currently have this which works well for the most part. I am also performing a lookup on my server side to an external URL. This can take a few seconds to return data. The problem is that when the enxternal lookup takes a few seconds to respond, datatables has already reported no data. I am assuming I need a callback function or similar but cant workout how to do this.

Any help would be great!

Thanks

    courseTable = $('#courseSearch').DataTable({
        "ajax": {
            "bProcessing": true,
            "bServerSide": true,
            'url': '<someurl>',
            'data': function(d) {
                distance_val = $('#distance_10').is(':checked') ? 1 : 0;
                d.distance = distance_val;
            }
        },
        "oLanguage": {
            "sEmptyTable": "No courses match this criteria"
        },
        "columns": [
            {"data": "code"},
            {"data": "code"},
            {"data": "code"},
            {"data": "code"},
            {"data": "code"}
        ],
        "dom": 'ltp'
    });
This discussion has been closed.