Ошибка получения json кода в jquery

Если будет ссылка https://.../profile то все отлично работает и выводит, если https://.../profile/?code=... то выводит ошибку

Uncaught SyntaxError: Unexpected token < in JSON at position 2
at Function.parse [as parseJSON] (<anonymous>)
at Object.success (profile.js:9)``` 

а вот код из js файла

$.ajax({
    type: "POST",
    url: "engine/jquery/profile.php",
    data: {
        loader: true
    },
    success:function(response) {
        response = $.parseJSON(response);
        $('#login').html(response.login);
        $('#mylogin').html(response.login);
        $("#avatar").attr("src", response.avatar);
        $("#myavatar").attr("src", response.avatar);
        $('#mail').html(response.mail);
        $('#group').html(response.group);
        $('#datareg').html(response.datareg);
        $('.preloader').fadeOut().fadeOut('slow');
    },
    error:function(response){
        console.log(response);
    }
}); 

Ответы (1 шт):

Автор решения: Sergey Pomazan

Решил, указывал не полный путь к файлу, и по переходу по этому файлу его перебрасывало на индексированную страницу и мне выводил код

→ Ссылка