Today now in this blog i will show you how to solve codeigniter angularjs http problem. Sometimes, we are face problem we can’t get post data by using $this->input->post(), when we fire $http.post() by using AngularJS or Jquery. here I also face this issue, but i can’t receive the post value when i fire $http.post in AngularJS, But i was found how to receive post data or json data in Codeigniter controller.Now in the following example through i can solve this problem:
public function store()
{
$this->load->database();
$_POST = json_decode(file_get_contents('php://input'), true);
$posts = $this->input->post();
$this->db->insert('posts', $posts);
}
Read Also :Laravel and AngularJS CRUD with Search & Pagination Example
Thanks for read. I hope it help you. For more you can follow us on facebook.