ajax通过请求数据,请求成功回调一直进error

$.ajax({
            type: "json",
            url: "http://xxx",
            dataType: "json",
            success: function (data) {
                console.log(1);
                console.log(data);
            },
            error: function (e){
                console.log(0);
                console.log(e);
            }
        });

请求是上面这样的,接口用postman用浏览器请求都能看到数据的返回,ajax请求,回调一直走error,看来一下后台返回的数据,发现后台返回的数据并不是我要的json格式(dataType: "json"),所以告诉后台处理就行了

发布了76 篇原创文章 · 获赞 9 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/github_38928905/article/details/89555227