Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript &引用;意外标记“;将JSONP与Angular JS结合使用_Javascript_Angularjs - Fatal编程技术网

Javascript &引用;意外标记“;将JSONP与Angular JS结合使用

Javascript &引用;意外标记“;将JSONP与Angular JS结合使用,javascript,angularjs,Javascript,Angularjs,我尝试使用JSONP,因为如果使用$http.get,就会出现XMLHttpRequest错误。这是我的代码: .controller("showbusCtrl", function ($scope,$http) { var url = "http://m.aucorsa.es/inc/json/lineas.json"; var urlJsonp = "?callback=JSON_CALLBACK"; $http.jsonp (url + urlJsonp)

我尝试使用JSONP,因为如果使用$http.get,就会出现XMLHttpRequest错误。这是我的代码:

 .controller("showbusCtrl", function ($scope,$http) {

    var url = "http://m.aucorsa.es/inc/json/lineas.json";
    var urlJsonp = "?callback=JSON_CALLBACK";

   $http.jsonp (url + urlJsonp)
    .success(function(data) {
        this.lineas = lineas.data;
    });
});

有解决办法吗?谢谢大家!

$.getJSON('http://m.aucorsa.es/inc/json/lineas.json,函数(数据){//do something})
检查:您的JSON/p是否正确?此服务器不支持JSONP,它基本上忽略了
回调
参数。