Backbone.js PUT / DELETE issues with Codeigniter REST Server

NOTE. This question is related to CodeIgniter-RestServer

When I call model.save () from the trunk, the function where the put request is routed does not receive any PUT data. Firebug shows correct PUT parameters. However, $ this-> put ('keyname') always returns false. This means that the CI REST Server cannot find the PUT data as it should.

On the other hand, if I install:

Backbone.emulateJSON = true;  

      

I can work, as then Backbone will send all PUT data under one attribute named "model" using this way $ this-> put ('model'); work

Then an additional effect is involved:

$data = json_decode($this->put('model'),true); // to get normal behavior #sucks

      

+1


source to share


2 answers


I ran into this issue and pushed a few changes that fix the issue: https://github.com/philsturgeon/codeigniter-restserver/pull/84



+1


source


passed this problem in the past. The solution to this problem is to use this in your functions:

$data = $this->request->body;
echo $data['id'];

      



Hope that solves this. Hooray!

0


source







All Articles