I have a small and likely silly oversight on a piece of script that was actually working a few weeks ago.
$( document ).ready(function() {
$( "#subscribe-btn" ).click(function() {
var email = $( "#subscribe-input" ).val();
if(email != ""){
$.ajax({
type: "POST",
url: "/subscribers",
data: {
email : email
},
dataType: "html"
});
}
else {
alert("Email field is empty!");
};
});
});
When the button is clicked, it returns the error 400 (Bad Request)
. How to fix this error?