Passing HTTP Request from Backbone.js to CodeIgniter to DB?

I'm not too sure as to why your title param is not getting passed. I would recommend using Firebug or Chrome Inspector to check if the title param actually got sent. You can narrow down your debugging from there As for the URL, the RESTful way to do it would be to use MyApp/index.

Php/app/user/id" to manage a single user EDIT It looks like your request is sent fine. I would examine the post data. Why not print the post data and see what is received.My guess is PHP is not reading the JSON data correctly.

You can use $decoded = json_decode($this->post('title')) to turn it into a php object.

I'm not too sure as to why your title param is not getting passed. I would recommend using Firebug or Chrome Inspector to check if the title param actually got sent. You can narrow down your debugging from there.As for the URL, the RESTful way to do it would be to use MyApp/index.

Php/app/user/id" to manage a single user EDIT It looks like your request is sent fine. I would examine the post data. Why not print the post data and see what is received.

My guess is PHP is not reading the JSON data correctly. You can use $decoded = json_decode($this->post('title')) to turn it into a php object.

– William Sham Aug 10 at 19:53 edited it to reflect new information – userinev Aug 11 at 5:26.

I had some problems with this as well. My solution: $data = json_decode(file_get_contents('php://input'), true); $this->site_model->create($data).

You need to change this line under your Controller: $this->post('title') To $this->input->post('title') or actually you can use plain PHP for accessing your POST global variables, like $_POST'title'. As reference, check the CodeIgniter's Input Class.

Try accessing $this->request->body It should contain the contents of all the values you are posting via Backbone.js.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions