Verificación de token de portador del encabezado ajax

        $.ajax({
            url: "xxxxxxxxxx",
            type: "post",
            contentType: "application/json;charset=utf-8",
            headers: {
                "Authorization": "bearer "+token  //bearer后面必须要有空格,并且bearer大小写有区别,需与后台验证保持一致
            },
            dataType: "json",
            data: “xxxxxxxxxx”,
            success: function (data) {
                console.log("请求结果: " + JSON.stringify((data)));
            },
            error: function (info) {
                alert("請求失敗")
            }
        });

Supongo que te gusta

Origin blog.csdn.net/Mrlujiao_code/article/details/112991821
Recomendado
Clasificación