[eluser]Rubiz'[/eluser]
Yes, with Ajax, and I dont know hoew posting without refresh page, as it happen on You Tube.
My code view:
Code:
$.ajax({
url: '<?=base_url()?>item/rating/<?=$item->id?>/' + grade,
cache: false,
type: 'POST',
success: function(html){
$("#response").html(html);
}
});
My controller:
Code:
function rating($id, $grade)
{
/* get user id based on the current session */
$user_email = $this->db_session->userdata('email');
$user_id = $this->User_model->get_id_by_email($user_email);
/* deny access to not logged users */
if (!$user_id || !$this->db_session->userdata('logged_in')) {
echo "warn_fadeIn('non_logged')";
return;
}
/**
* Update item_rating
*/
$rated = $this->Item_model->rate($id, $user_id, $grade);
if ($rated == TRUE)
echo "warn_fadeIn('rating')";
else
echo "warn_fadeIn('already_voted')";
}
Those javascript calls tags only works with firefox.