I’m trying to make a script to post to my codeigniter controller, this is what I’ve tried:
$(document).ready(function(){
$('input.atualizar').click(function(){
var observacoes = $('textarea#textarea_observacoes').val();
var pac_id = $('input#member_id').val();
var tipo = 'observacoes';
$.post("pacientes/update", { "observacoes" : observacoes, "pac_id" : pac_id, "tipo" : tipo },
function(data){
alert(data.result);
alert('aaaa');
}, "json");
});
});
yet It’s not doing anything, not alerting anything from alert(data.result), not posting, nothing on the debugger, this is my php function
function update(){
$ar = array(
'observacoes' => $this->input->post('observacoes'),
'pac_id' => $this->input->post('pac_id'),
'tipo' => $this->input->post('tipo')
);
echo json_encode($ar);
}
try this to see the exception: