php - Angularjs $http post didn't pass param? -
i've been debugging hours. tried set header etc no luck!
my controller
$http({ url: 'http://myphp.php/api.php', method: "post", data: {'wtf':'test'} }) .then(function(response) { console.log(response); }, function(response) { // optional // failed } );
and php
<?php echo "test"; echo $_post["wtf"]; ?>
in network tab how
not sure what's wrong man, exhausted, i'm stuck hours! why $_post['wtf] didn't echo?
$http serializing data json in request body php's $_post looking key/values parsed posted form data. these 2 different mechanisms posting data need choose 1 , use mechanism on both sides.
you have 2 options solve this:
Comments
Post a Comment