Контроллер
Код: Выделить всё
public function rating()
{
$rating = $this->db
->select_avg('hasil_rating')
->get('tb_rating')
->row_array();
echo json_encode($rating);
}
Код: Выделить всё
function rate() {
$.ajax({
type: 'POST',
url: '',
dataType: 'json',
success: function(data) {
$('#aaaa').val(data);
}
});
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/493 ... x-response
Мобильная версия