hello i am building a project with laravel, where i am passing the multiple data from CategoryController to Category blade file, but the problem is when i am inserting data it is successfully inserted and i want to reload the datatable with the new record but my existing table of id example1 is going inside of another table of id example1 why? Here are my codes...
script
$("#example1").DataTable();
$(document).on('submit','.database_operation',function(e){
e.preventDefault();
var url = $(this).attr('action');
var data = $(this).serialize();
$.ajax({
url:url,
method:"POST",
data:data,
success:function(fb){
var resp = $.parseJSON(fb);
// console.log(resp);
if(resp.status=='true'){
toastr.success(resp.message,'Success');
$('#myModal').hide();
$('.modal-backdrop').remove()
$(document.body).removeClass("modal-open");
$('#example1').DataTable().clear().destroy();
$("#example1").DataTable();
$("#example1").load(" #example1");
}else if(resp.status=='false'){
$.each( resp.message, function( key , value ) {
toastr.error(value + '<br>','Error');
});
}else if(resp.status=='false-1'){
toastr.error(resp.message,'Error');
}
}
});
return false;
});
Hey i am beginner with laravel and jquery trying to learn please help me with the best possible way.