0

Here I am sending post request to my manager/approveit controller

Here I am sending post request to my manager/approveit controller ^^

And i am receiving the data like this in my controller manager's function approveit() like this

public function approveit(){
    //print_r($id);
    print_r(json_decode(file_get_contents('php://input')));
    $this->input->post();
    echo "halalala";
}

But i am not even redirected to the page manager/approveit. I have seen answers like:-

Codeigniter + Angular Js: How to receive JSON data

How can I post data as form data instead of a request payload?

and have applied them but they didn't work here, please tell me how to send post request from angular to my php CI controller.

Asim
  • 1,430
  • 1
  • 22
  • 43

1 Answers1

0

can you show the output of your browser console.

also, isn't there a typo in your code line 76

maybe it should be that:

data: {id: $scope.id}

and also can you write the promise callback and print in the console the output

.then(function(response)...);

erwan
  • 887
  • 8
  • 17
  • I am getting "status: 200 OK" as response if I add .then(function(res){console.log(res)}); Also did "data: {id: $scope.id}" , still doesn't work. – Asim Sep 13 '17 at 16:45
  • I am getting id "12345" as output though from angular function. – Asim Sep 13 '17 at 16:45