When making a JSON call from my controller.js:
$scope.userInvestors = userInvestors.query({UserID:$scope.user.uid},
function(userInvestors) {
console.log("yep yer here");
}
Using this $resource:
factory('userInvestors', function($resource){
return $resource('http://wherevertheserveris/Rest/userInvestors.php', {}, {
query: {method:'GET', params:{}, isArray:true}
});
})
The console gets updated as expected with: yep yer here.
If I switch 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?");
}
Along with the following resource:
factory('userInvestors', function($resource){
return $resource('http://wherevertheserveris/Rest/userInvestors.php', {}, {
query: {method:'JSONP', params:{}, isArray:true}
});
})
No output is shown in the console even though the call was successful and data was retrieved. How can I make my JSONP log statement print?
ANSWER:
Thanks for all the answers provided below. It turns out that I needed to format the return response from the API correctly.
Instead of returning NULL via PHP like this: print $callback."null";
I should have returned an empty array inside a function wrapper or any other properly formatted JSONP response. In my case, it should be: print $callback."([])";