2013-06-04 27 views

回答

1

随着JSONP“黑客”,你必须确保服务器的响应包含回调的调用。为了使您的工作,例如,你应该改变prov.json文件,所以它看起来像如下:

angular.callbacks._0({ 
    "id": "40796308305", 
    "about": "The Coca-Cola Facebook Page is a collection of your stories showing how people from around the world have helped make Coke into what it is today.", 
    ... 
}) 

上有许多JSONP来源,例:What is JSONP all about?

0

用得到的,而不是JSONP,你cokacola的细节...

async: function(page) { 
    var url = 'prov.json';  
    var promise = $http.get(url).error(function (response, status) { 
     alert("fai"); 
    }).success(function (response, status) { 
     alert(response.about); 
    }).then(function (response, status) { 
     return response.data;   
    }); 
    return promise; 
}}; 
+1

是的,我知道,但我需要一个JSONP,一个得到我打算使用它会给我一个跨域例外。 –