The data I added from the modal is successfully saved in the database. But I can't show it in the table. What's wrong with the code below? I'm new to ajax. tabbleadd() is defined as onclick on the button Thanks
onclick="Tabloyaekle()
''' function tableadd(data) {
$.ajax({
type: "POST",
url: '/Haberler/AddNews',
data: data,
success: function (data) {
if (data.success) {
var t = $('#exampleModalSizeLg').DataTable();
t.row.add(data);
Swal.fire(
'Başarılı',
'Eklendi',
'success'
)
}
else {
Swal.fire(
'HATA',
'!' + data.mesaj,
'error'
)
}
},
error: function () {
Swal.fire(
'HATA',
'Eklenemedi',
'error'
)
}
})
} '''