Как вывести сообщение {“message”:“Unauthenticated.”}?

Как вывести сообщение на экран?
в консоле выводит

{"message":"Unauthenticated."}

но в ajax не выводит

$("body").on("click",'.comment--item .rcomment', function() {
            const that = $(this);
            let comment = $(this).closest('.comment--item').attr('data-id');
            let article = $(this).attr('data-rel');
            let fullname = $(this).closest('.comment--item').find('.user--link').text();
            let token = $('[name="csrf-token"]').attr('content');
            $.ajax({
                type: "POST",
                url: "/comment/replay",
                data: { // что отправляем
                    "comment":    comment,
                    "fullname":   fullname,
                    "article":   article,
                    '_token' : token
                },
                cache: false,
                success: function(response){
                    if (response.message){
                        alert(response.message);
                    }
                    if (response.error && response.error === 1){
                        toast.fire({
                            type: 'error',
                            title: response.message
                        });
                    }else {
                        $("#replay-form").fadeOut(2000).remove();
                        that.closest('.comment--item').append(response);
                    }
                }
            });
        });
  • Вопрос задан
  • 146 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы