$(document).ready(function() {
$('#example').dataTable();
$('#addbtn').click(addrow);
} );
function addrow() {
$('#example').dataTable().fnAddData( [
$('#fname').val(),
$('#lname').val(),
$('#email').val() ] );
}
you need to call the addrow() in the button click.
Add this button in your html code