Codeigniter Angularjs http post not working

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

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.

About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →