I’m trying to post my formdata to another page, using JSON. I want to simply get my values at this stage. i’ll do some checks and return an object at the end which will include a status with true or false depending if my data is okay (registration form)

Here is my JS (currently logging text to see what’s printed)

https://jsfiddle.net/b6Ls7f2c/

My PHP code looks like this but I can’t echo a response

header('Content-Type: application/json; charset=utf-8');
$post = file_get_contents('php://input');

echo $post[0][1];

    $post is just going to be a string; $post[0][1] doesn't make much sense.
    It might also help to disable the header claiming what you're outputting is JSON until you know you're actually outputting valid JSON, so that the browser you're checking with doesn't refuse to parse something if it's malformed.

      Write a Reply...