0

my directory structure:
enter image description here

and thats my ajax Function to send my JSON to my PHP:

var myJson={"username":"fsa","name":"fs","lastname":"fdsa","password":"aaa"}
request=new XMLHttpRequest()
request.open("POST", "controller/login.php", true)
request.onload = function () {

if (request.status === 200) {
   console.log(request.status)
} else {
    console.log(request.status)
   }
}
request.setRequestHeader("Content-type", "application/json")
request.send(myJson)

console.log(request.status) returned the Value "200" so i don´t think i have a falso function?

On my PHP File i will try to get my Json File.

$test = $_POST;
var_dump($test);
echo($_POST);
die();

and the response is: array(0) { } Array

Dennis Schaffer
  • 556
  • 7
  • 17

0 Answers0