how to send ajax response in laravel controller code example
Example: laravel ajax post data to controller
$.ajax({
url: "/route/to",
type: 'POST',
beforeSend: function (request) {
return request.setRequestHeader('X-CSRF-Token', $("meta[name='csrf-token']").attr('content'));
},
success: data => {
console.log(data);
}
});