Javascript object to PHP -


i posting javascript objects php backend not able retrieve data.

i posted java-script object:

{"name":"mastermold"} 

i trying access name this:

$name= $_post["name"]; 

the error is:

{"error":{"type":"errorexception","message":"undefined index: name","file":"c:\program files (x86)\ampps\www\app\controllers\journalscontroller.php","line":34}}


savemongojournal=function(thejournal,dothis) {                         journalroute="http://localhost/public/journals"                         $http.post(journalroute,thejournal).success(dothis);                          };  $scope.clicky= function(){         savemongojournal( {name: "mastermold"},alertreply);                  };     $_post['name']; 

you may try (check this answer)

$data = json_decode(file_get_contents("php://input")); echo $data->name; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -