跨域使用ajax传递参数, 无法传递cookie问题

把传递的"application/json"参数改为"application/x-www-form-urlencoded", 具体参考代码:

    method() {
        var t = this;
        axios({
                method: "post",
                url: "/login",
                baseURL: "http://192.168.0.153:8088/",
                withCredentials:true,
                params: {
                    username: "zhangsan",
                    passWd: "123"
                },
                responsetype:'json',
                headers:{'Content-Type': 'application/x-www-form-urlencoded'}
        }).then(function(response){
            //console.log(response);
        }).catch(function(error){
            console.log(error);
        });
    },
注 : 有不足的地方, 欢迎各位朋友评论留言!!!

猜你喜欢

转载自blog.csdn.net/luan666/article/details/80429869
今日推荐