title: Getting a return value from php with backbone.js
body: <p>Hello i have the  following codeIgniter Controller php code that saves a Backbone Model to the server</p>
  
  <pre><code>public function generate()
      {
         //Converts JSON object to array
         $data = decode(TRUE);
         $this-&gt;load-&gt;library('db_models',$config=array('localhost', 'user', '343boys'));
         $data = $this-&gt;db_models-&gt;getFields($data['database'],$data['table']);
         //Converts $data to JSON object
         $data = encode($data);
         //Problem is here how to i assign this data back to my model.
         return $data;
  
      }
  </code></pre>
  
  <p>I have created a JSON helper decode and encode that that converts JSON to array and array to JSON respectively. This have no proble as i have tested them with firebug.
  the code works alright when saving but i have hit a snag when i try to retrieve the return $data; after the function has finished saving.</p>
  
  <p>My Model is like so</p>
  
  <pre><code>var Table = Backbone.Model.extend({
       defaults:{
         'table':'mine',
         'database':'db'
  },
          urlRoot : '/campusfeed/index.php/welcome/generate'
  
      });
  model.save();
  </code></pre>
  
  <p>So how would i go about saving a value through a function and retrieving what the function returns not neccessarilt in codeigniter.</p>