if i make this JSON call from my controller.js:
$scope.userInvestors = userInvestors.query({UserID:$scope.user.uid},
function(userInvestors) {
console.log("yep yer here");
}
with this $resource:
factory('userInvestors', function($resource){
return $resource('http://wherevertheserveris/Rest/userInvestors.php', {}, {
query: {method:'GET', params:{}, isArray:true}
});
})
then the console is updated as expected with: yep yer here
however if I change the request to a JSONP request:
$scope.userInvestors = userInvestors.query({UserID:$scope.user.uid,
callback: 'JSON_CALLBACK'}, function(userInvestors) {
console.log("but are you here?");
}
and the resource:
factory('userInvestors', function($resource){
return $resource('http://wherevertheserveris/Rest/userInvestors.php', {}, {
query: {method:'JSONP', params:{}, isArray:true}
});
})
nothing is printed to the console even though I know the call was completed and the data retrieved?
how do I get my JSONP log statement to print?
ANSWER:
thanks to both answers below: I needed to properly format the return response from the API.
In the case of NULL I was returning via PHP: print $callback."null";
What I needed to return was just an empty array inside a function wrapper, or whatever other properly formatted JSONP response you find appropriate. In my case it was: print $callback."([])";

