Question

NOTE: This question is related to CodeIgniter-RestServer

When I call model.save() from backbone the function where the put request is routed doesn't gets any PUT data. Firebug shows right PUT parameters being sent. However $this->put('keyname') always returns false. Which means CI's REST Server can't find PUT data as it should.

On the other hand, If I set:

Backbone.emulateJSON = true;  

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

Then the extra effor involved is:

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

Solution

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

OTHER TIPS

have been through this problem already in the past. Solution to this problem is to use this inside your functions:

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

Hope that solves it. Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top