JS:
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)
}
When im trying submit form, i have error:
400 Bad Request Your browser sent a request that this server could not understand.
Can somebody help me? Thanks anyway :)
The key here is this statement: 'that this server could not understand'. This usually indicates that something is wrong on the server. But it could also be that your url is wrong. Either...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.