1
I have a code that forms the user’s profile screen. Next to the user’s name he has the edit option, that when clicking opens an inline Edit (form-x-Editable.html). Even in this part is working normally, but clicking to save gives error Networkerror: 500 Internal Server Error. I don’t know what could be wrong. My code is in MVC
View:
<span rel="tooltip" data-placement="right" data-original-title="Nome">
<a href="form-x-editable.html#" style="font-size: 14px;" id="nome" data-type="text" data-placement="top" data-pk="14" data-original-title="Nome">Editar</a>
</span>
Javascript:
var nome;
nome = '<?= $dados->nome ?>';
$('#nome').editable({
url: '/Controller/editar',
type: 'text',
pk: 14,
name: 'nome',
title: 'Nome',
params: function (comp) {
comp.id_span = 'span14';
comp.id = di_id;
comp.e_id = epr_id;
return comp;
},
ajaxOptions: {
type: 'GET',
dataType: 'json',
contentType: 'application/json'
},
success: function (j) {
$('#span14').html(j.nome);
$('#dispName').empty();
$('#dispName').html(j.nome);
},
value: nome,
display: false
});
Controller:
public function editar(){
switch($this->input->get('id_span')){
case 'span14':
$data['nome'] = $this->input->get('value');
$id = $this->input->get('id');
$e_id = $this->input->get('e_id');
$this->session->set_userdata('nome',$this->input->get('value'));
$this->MT->editPerfil($id,$e_id,$data);
break;
}
echo json_encode($data);
}
}
Model:
public function editPerfil($id, $e_id, $data) {
if ($this->vrfUsrEmp($e_id)) {
if (isset($data['nome'])) {
$this->db->set('nome', $data['nome']);
}
$this->db->where('id', $id);
$this->db->where('e_id', $e_id);
$this->db->update('NomeTabela');
return $this->db->affected_rows();
} else {
return false;
}
}
In the problem file, add at the beginning:
ini_set('display_error', true); error_reporting(E_ALL);
– rray
@rray is like there is no such code
– Ketlin
What do you mean? I don’t understand
– rray
There would be no way to view the errors in the browser
– Giancarlo Abel Giulian
@Giancarlogiulian I opened Firebug to present code errors and shows this when I click to save the change
– Ketlin
Good night, man you’re working as a REST API?
– rpereira15
There is no place in your Codeigniter to show errors ?
– Diego Souza