JavaScript Issue:
function submitForm(){
var data = {
name: _("#name").value,
email: _("#email").value,
message: _("#message").value
}
var output = JSON.stringify(data);
var ajax = new XMLHttpRequest();
ajax.open( "POST", "/src/scripts/parser.php" );
ajax.setRequestHeader("Content-Type", "application/json'");
ajax.onreadystatechange = function() {
if(ajax.readyState == 4 && ajax.status == 200) {
console.log('success')
} else {
console.log('fail')
}
}
ajax.send( output );
console.log(output)
}
Encountering Error When Submitting Form:
400 Bad Request Your browser sent a request that this server could not understand.
Seeking Assistance with Fixing This Issue. Thanks in advance :)