0
I’m starting to use AJAX now, so I don’t know if this is what’s going on with him. I made this code to do a CPF search in the database
$('#btn_buscar_cpf_responsavel').on('click', function(){
var cpf = $('#aluno_responsavel_cpf').val();
if (cpf == '') {
alert('Informe um CPF');
} else {
$.ajax({
url: '192.168.0.26/cvt-sergipetec/utils/verify_responsavel_cpf',
type: 'POST',
data: {'cpf' : cpf},
dataType: 'json',
success: function(data) {
if ($.isEmptyObject(data)) {
alert('Responsável não cadastrado');
$('#responsavel_novo').val(1);
} else {
$('#aluno_responsavel_nome').val(data[0].responsavel_nome);
var rg_uf = data[0].responsavel_rg + '/' + data[0].responsavel_rg_uf;
$('#aluno_responsavel_rg').val(rg_uf);
}
},
error: function() {
alert('Ocorreu um erro' + Error);
}
});
}
});
And I want him to send the post to this URL, but he’s completing the URL from where he was called the one I passed on the code, and here’s the following:
http://192.168. 0.26/cvt-sergipetec/pupils/192.168.0.26/cvt-sergipetec/utils/verify_responsavel_cpf
Have some way so that it doesn’t start the URL with http://192.168.0.26/cvt-sergipetec/alunos
?
He’ll send the one you put in the option
url
, that is to say:url: '192.168.0.26/cvt-sergipetec/utils/verify_responsavel_cpf'
– Sam
So he’s sending it to http://192.168. 0.26/cvt-sergipetec/students/ (where AJAX was called) + which I put in the url option: 192.168.0.26/cvt-sergipetec/utils/verify_responsavel_cpf
– Leandro Souza
puts
http://
inurl
since you are informing the absolute way. So:url: 'http://192.168.0.26/cvt-sergipetec/utils/verify_responsavel_cpf'
– Sam
It worked! Thank you!
– Leandro Souza