`I tried to post method in ajax request Method Not Allowed in js and give me Status Code 405
// js code
const xml = new XMLHttpRequest();
xml.onload = function(){
console.log(this.responseText);
}
xml.open("POST","receive.php",true);
xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xml.send("name=kareem&lastvist=Today");
// php code
<?php
foreach ($_POST as $post_var) {
echo strtoupper($post_var)
}
?>
`