Reputation: 13842
My function
$scope.doCall = function(){
console.log('test');
$http.jsonp('http://api.v2.quran.com/info/surah?callback=JSON_CALLBACK').
success(function(data) {
// this callback will be called asynchronously
// when the response is available
console.log(data[0]);
})
var url = "http://public-api.wordpress.com/rest/v1/sites/wtmpeachtest.wordpress.com/posts?callback=JSON_CALLBACK";
$http.jsonp(url)
.success(function(data){
console.log(data);
});
}
When I look at my network, the second call wraps angular.callbacks._1(OBJECT)
while the first just returns [...ARRAY OF OBJECTS...]
The second will output in my console, the first is not doing anything! How can i make it work!
Upvotes: 0
Views: 286
Reputation: 1266
Thats API problem, http://api.v2.quran.com didn't wrap JSON to JSON_CALLBACK, in second case JSON starts with JSON_CALLBACK({... but in first case you get pure JSON, not JSONP. Try to fix it on server.
Upvotes: 1