$(document).ready(function() {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$('.editButton').on('submit', function(event) {
event.preventDefault();
var formData = new FormData(event.target);
var dataId = $("#categoryForm").attr("data-id");
$.ajax({
type: 'POST',
url: "{{ url('category/update') }}/" + dataId,
data: formData,
processData: false,
contentType: false,
dataType: 'json',
success: function(data) {
var obj = jQuery.parseJSON(data);
if (obj.success == 'ok') {
Swal.fire({
type: obj.type,
title: obj.title,
text: obj.message,
confirmButtonText: "Tamam",
timer: 3000,
}).then(() => {
/** Dashboard Redirect */
window.location.href = obj.redirect;
});
} else if (obj.success == "no") {
alert('test');
s
}
},
error: function(err) {
Swal.fire({
type: "error",
title: "Uyarı!",
text: "Lütfen Gerekli Bilgileri Boş Bırakmayınız.",
confirmButtonText: 'Tamam',
})
}
})
});
});