首页 > vue resource发送post请求问题

vue resource发送post请求问题

 this.$http.jsonp({
                url: 'http://www.xxx.com/index.php/Home/Login/loginProcess',
                method: 'POST',
                emulateJSON: true,
                data: {
                    robot:123,
                    phone:"13881119614",
                    password:"menji111",
                    usertype:0
                }
            }).then(function(response) {

                console.log(response.data);

            }, function(response) {

            });

跨域

已经是jsonp了啊

XMLHttpRequest cannot load http://www.cxxx.com/index.php/Home/Login/loginProcess. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.


跨域问题,让你的后端工程师处理吧,让他们在响应头里加:

Access-Control-Allow-Origin: *

当然如果你对跨域问题有兴趣,推荐阅读构建public APIs与CORS

【热门文章】
【热门文章】