I cannot help without the server side code.
Normally you need to do two queries. One without limit which is only fetching the total number of records with a count(*) and one with the limit which is fetching the data. The returned data then contains the total number, the filtered number and the display number. But this is all described in the datatables manual