Codeigniter + Angular Js: How to receive JSON data Codeigniter + Angular Js: How to receive JSON data codeigniter codeigniter

Codeigniter + Angular Js: How to receive JSON data


thanks for the reply.solution is as follows

$obj=json_decode(file_get_contents('php://input'));

you can test it by

print_r(json_decode(file_get_contents('php://input')));


$_POST will be empty in CodeIgniter because it purposely empties it for security reasons. You need to use $this->input->post(); instead.

CodeIgniter Input Class


Use:

$postData = $this->input->post();

It should give you an array with all the post data.

I also advise you to turn on XSS filtering.

Following is the documentation for the Codeigniter Input Class: http://ellislab.com/codeigniter/user-guide/libraries/input.html