[eluser]Christophe28[/eluser]
Hi,
I use jeditable together with CodeIgniter and it works like a charm. Debug the script from step one. In the controller check if both values are actually submitted by echoing them right back to the script and so on ...
Here is my code for what it is worth:
JS
Code:
$('.fileDescription').editable('/update_file_description/', {
type : 'textarea',
cols : 40,
rows : 5,
indicator : "<img src='/images/ajax-loader.gif' />",
submit : 'OK',
cancel : 'Cancel',
onblur : 'ignore'
});
CONTROLLER:
Code:
function update_file_description() {
// User language
$lang = $this->sitewide->user_language();
// Get the POST values
$file_id = $this->input->post('id');
$description = $this->input->post('value');
// Get the user id out session table
$user_id = $this->session->userdata('user_id');
// Check if user is authenticated to edit this file
$user_auth = $this->sitewide->ajax_file_auth($user_id, $file_id);
if($user_auth == TRUE) {
// If the user is authenticated, update the database
$this->files_model->update_file_description($file_id, $description);
} else {
echo $lang->You_are_unauthorized;
exit;
}
// Simply give back the $_POST title
echo $description;
}
And finally the files model:
Code:
// Update file description (= using jquery plugin jeditable)
function update_file_description($file_id, $description) {
$q = "UPDATE files SET description = ? WHERE id = ?";
$this->db->query($q, array($description, $file_id));
}
Please tell me if you manage it to work now.
Christophe
PS: I wouldn't create a special model just for jeditable, but rather one model for each table ;-)