请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

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

https://img1.sycdn.imooc.com/szimg//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)

        })

    }


正在回答 回答被采纳积分+3

1回答

fishenal 2017-09-05 14:11:15

这种情况我没遇到过,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 回复 有任何疑惑可以回复我~
  • 提问者 往事如风_forever #1
    嗯嗯,还是跨域的问题,数据其实请求到了
    回复 有任何疑惑可以回复我~ 2017-09-07 16:10:54
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号