My View Field ввода. < /p>
Код: Выделить всё
< /code>
мой код JS - < /p>
$("#refby").typeahead({
source: function (query, process) {
return $.get("", { query: query }, function (data) {
console.log(data);
data = $.parseJSON(data);
return process(data);
});
}
});
< /code>
Функция контроллера - < /p>
public function get_doctor()
{
$check = $this->input->post('check');
$data = $this->customers->get_doctor($check);
echo json_encode( $data);
}
< /code>
Функция модели - < /p>
function get_doctor($check)
{
print_r($check);
$this->db->select('name');
$this->db->like('name', $check);
$this->db->from('doctors');
$query = $this->db->get();
return $query->result();
}
< /code>
Ссылка сценария - < /p>
Подробнее здесь: [url]https://stackoverflow.com/questions/79685797/typeahead-js-is-fetching-invalid-json-data-on-live-server[/url]
Мобильная версия