server does not return data I send with angular2

Asked

Viewed 44 times

0

the code of the Component

 onSubmit(form){ 
    var success = false;
    var error = false;

    this.http.post(`http://localhost/api/`, 
    JSON.stringify(form.value))
    .map(res => res)
    .subscribe(dados => console.log(dados));

  }

the php code of the server

if(!isset($_POST)):
    ResultJson(['erro'=> true, 'messagem'=> 'nenhum dado foi informado']);
else:
    var_dump($_POSt);
endif;

the problem is that returns an empty array I’ve tried several ways and can’t solve anyone can help me? I appreciate the strength of vcs

  • See that there is a typo in your PHP code: var_dump($_POSt); -> var_dump($_POST);

  • I managed to solve rsrs the problem was not that but I managed to thank

  • If you have already succeeded you can delete the question or answer it yourself and mark your answer as correct

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.