'How can I filter the office id using codeigniter?
I am a student who is practicing Codeigniter. This is the script that I have formed.
$(document).ready(function () { $('#hiddenDO').each(function () {
$('#displayoffice').val($("#hiddenDO option:selected").val());
$.ajax({
type: "GET",
url: '<?= site_url('client/displayoffice') ?>',
data: {"msg":msg},
dataType:"json",
success: function (data) {
console.log(data);
}
});
return false;
});
}
Controller
public function displayoffice() {
$data = $this->input->post();
$result['hiddenDO'] = $data;
echo json_encode(array($result));
exit(0);
}
and my Model
function filterOffice() {
$data = '3'; //In this part I want to call the value to filter
$query=$this->db->query("SELECT bi_emplname, bi_empfname, bi_emppic FROM `tblemployee`
INNER JOIN `tbl_office` ON ji_off_id=off_id
INNER JOIN `tbl201_basicinfo` ON bi_id=ji_bi_id
WHERE ji_off_id='$data'");
return $query->result_array();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
