[eluser]onuryasar[/eluser]
this is really one of the weirdest coding struggles i've had in my whole life.
today i added jeditable to my codeigniter site and made it work very easily. however, after finishing the database update, i cannot get the value back on the page. but it's not js related, looks like it's totally something about php side.
look at the codes:
view (script):
Code:
...
...
<td><div id="<?php echo $product->products_ext_id ?>" class="product_title"><?php echo $product->title ?></div></td>
...
...
script
// <![CDATA[
$(document).ready(function() {
$(".product_title").editable("<?php echo base_url(); ?>/administrator/jeditable", {
submit : 'OK'
});
});
// ]]>
script
controller:
Code:
function index() {
$this->load->model('jeditable_model');
$data['feedback'] = $this->jeditable_model->insert_value($this->input->post('id'),$this->input->post('value'));
$this->load->view("admin/jeditable_feedback_view",$data);
}
view (output):
Code:
$this->output->set_output($feedback);
the model is the part where it gets weird. the variables $id and $value are succesfully passed to the function and the database is being succesfully updated. then all i want to do is to return $element_value, which was added to the database, so that it will be printed on the page. but returns nothing:
model:
Code:
function insert_value($element_id,$element_value) {
$data_db = array(
'title' => $element_value
);
$this->db->where('id',$element_id);
$this->db->update('products_ext',$data_db);
return $element_value;
}
if i try to add any dumb letter to the return value like
Code:
return $element_value.'asdf';
it returns succesfully as "asdf", so this shows that the problem is at the model but there's nothing between the database operation and the output, so how come the value cannot be echoed? is there such thing as "using the input value once"?? also, i tried to directly output the "value" without loading the model or doing the database update but no chance. i also tried the $this->output->set_output() method which was mentioned at another thread related to jeditable, but no chance on this one, either.
does anyone have any idea on this ?
thanks in advance