ItSolutionStuff.com

Codeigniter Angularjs http post not working

By Hardik Savani November 5, 2023
PHP jQuery Angular Codeigniter

Sometimes, you face problem you can't get post data using $this->input->post(), when you fire $http.post() using AngularJS or Jquery. I also face this issue, i can't receive post value when i fire $http.post in AngularJS, But i found how to receive post data or json data in Codeigniter controller. in following example through you can solve your 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);

}

Tags:
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

More Posts You'll Love

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy