2013-06-04 31 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,一個得到我打算使用它會給我一個跨域例外。 –