Relative Content

Tag Archive for ajaxlaravel-10

Why get error? 404 not Found using laravel and ajax

$(function(){
$("#add_employee_form").submit(function(e) {
e.preventDefault();
var fd = new FormData(this);
$("#add_employee_btn").text('Adding...');
$.ajax({
url: "{{route('admin.store')}}",
method: 'POST',
data: fd,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (response) {
if (response.status == 200) {
Swal.fire(
'Added!',
'Emplojyee Added Successfully!',
'success'
)
}
$("#add_employee_btn").text('Add Employee');
$("#add_employee_form")[0].reset();
},
error: function (data) {
console.log(data);
}
});
});