Below is an implementation of an ajax call:
function requestSent(quote, author){
$.ajax({
type: "POST",
url: window.location.pathname,
data: {quote: quote, author: author},
dataType: JSON,
success: function(){console.log("Data received!");},
error: function(error){console.log("encountered an issue")}
});
}
The server code (using express) handling the post request is as follows,
app.post("/", function(req, res){res.status(200).end("Success!")});
However, the console displays "encountered an issue
" instead of "Data Received
"
All other parts have been thoroughly tested and are functioning correctly