'how to generate datatable headers from data

I am using datatables and currently putting the header and footer data in using HTML. I would like to make it more dynamic but can't seem to find a way to generate the headers from JSON data returned in the AJAX. Is there a way to do this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source