fetch http post requestObject

Hi, I’m new to Fuse. I plan to make an app that use a lot of post method to my php file in the server. this is how my code looks like and the output.

as you can see i pass name as parameter to my php file. but when i try to receive it in my php file, i got “unexpected <”

this is my php file

if i put abc = _POST[‘name’]; i will get the error message like this

I hope someone can help me to fix this problem

Thank You

Hi,

Instead of posting screenshots, prefer to post code in your forum post, indented by one tab.

That will create nice blocks like this :)

As for the error you are getting in the console, is that from Fuse or from PHP ?

oh I see okay. next time i will do it. Nvm sir. I just realize it’s my php problem. I accept it using post method as clear text. but actually the post method give me json format not the clear text, so i just need to decode it back from json format.

Thank You

hi I am having the same problem at the moment. Could you show your changes in php which solved the problem?

EDIT: I found out that the problem could be caused by missing decoding of the json request. This code worked very fine for me:

$data = json_decode(file_get_contents(‘php://input’), true);

$user = $data[‘username’]; $pass = $data[‘password’];