angularjs JSONP Uncaught SyntaxError:意外的令牌:

时间:2017-10-21 11:30:27

标签: javascript request jsonp

我的jsonp请求有问题。我正在使用AngularJS 1.6,我做了一个jsonp请求,我得到了错误的响应。 这是我的代码

this.changePhoto = function(){

        var getPhoto = function(){
            var params = {
                callback: "JSON_CALLBACK",
            };
            $sce.trustAsResourceUrl(context.upload_url)
            return $http.jsonp(context.upload_url, {
                params: params
            });
        }

        getPhoto().then(function(response){
           //Here video response
           console.log(response);
        });

    }

这是错误:

Uncaught SyntaxError: Unexpected token :

这是请求后的回复:

{"server":841237,"photo":"[]","hash":"09d049a834648f1f6dabab78327b449f"}

0 个答案:

没有答案