Uncaught SyntaxError: Unexpected token in JSON at position 0

后端 未结 3 1301
名媛妹妹
名媛妹妹 2021-01-27 09:59

With some help, I have managed to make a form that validates and confirms user password before adding the user to the database. I have encountered some problem as the data of th

3条回答
  •  时光说笑
    2021-01-27 10:24

    Have you set your content-type in your php?

    header('Content-Type: application/json');
    

    Also you don't need to put "true" in quote marks, when the json gets to your php script, once you run json_decode, php will recognise it as a boolean.

提交回复
热议问题