vue-resource实现Ajax获取信息数据时, ajax请求错误返回status 0是什么问题,url没有问题,http.jsonp请求的

来源:6-4 使用 axios 发送数据请求

往事如风_forever

2017-08-31

http://szimg.mukewang.com/59a7a65700011e9005010139.jpg

 getdata: function () {

        var vm = this;

        this.$http.jsonp('http://172.26.4.31:8080/project/info',{params:{page:1}})

        .then(function(res){

          var dates = JSON.parse(response.res)

          vm.focusList = res.data;  

          console.log(res.data)

        },function(err){

           console.log(err)

           console.log(123)

        })

    }


写回答

1回答

fishenal

2017-09-05

这种情况我没遇到过,status 0 可能还是跨域问题,简单搜了一下

https://stackoverflow.com/questions/38730918/vue-resource-and-jsonp-working-example


options里加以下jsonp字段试试,

还有我看文档里有个emulateJSON这个字段,可以改一下试试

搜出来的问题你可以参考一下:

https://stackoverflow.com/questions/14860877/jquery-ajax-call-getting-status-code-0-error

0
1
往事如风_forever
嗯嗯,还是跨域的问题,数据其实请求到了
2017-09-07
共1条回复

最容易上手的Vue2.0入门实战教程

快速入门Vue2.0,组件化开发一个数字产品电商平台

3966 学习 · 999 问题

查看课程