What is the error? Open f12 and network. Then make the request, click it in the list and select Preview
Feb 12, 2023
5
Level 1
Ajax POST request 500 (Internal Server Error)
hello, I'm building a Laravel website where I can press on favorite button to add a content of p tags tags to favorites table.. when I'm trying to use jQuery to submit the form I'm getting 500 error, you can find below my ajax request and my submit button in my blade :
$("#heart").click(function(e){
e.preventDefault();
var quote = document.getElementById('quote').textContent;
$.ajax({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
type: 'post',
url: '/quotes/favorites',
data: {
'quote':quote,
},
dataType: "application/json",
success: function (data) {
alert("success");
},
});
});
Please or to participate in this conversation.