AJAX completes the URL from where it was called

0

I'm starting to use AJAX now, so I do not know if this is what's going on with it. 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 it to send POST to this URL, but it is completing the URL where it was called the most that I passed in the pod, and it looks like this:

  

Is there any way for it to not start the URL with http://192.168.0.26/cvt-sergipetec/alunos ?

    
asked by anonymous 14.11.2018 / 13:55

1 answer

1

Since you are reporting the absolute path in the url option of Ajax, add the http:// protocol:

url: 'http://192.168.0.26/cvt-sergipetec/utils/verify_responsavel_cpf'

If not, Ajax will understand that this is a path from where it is being called, ie 192.168.0.26/cvt-sergipetec/utils/verify_responsavel_cpf is a subfolder.

    
14.11.2018 / 15:00