I'm not entirely sure what's going on, as I'm still trying to figure cross domain javascript calls, but I'm calling some JSON from a WordPress site (that's using the WordPress JSON REST API plugin). Since it's coming from a local site (I'm working on a mobile app using Ionic/Angular), I've had some cross-domain access issues. So, I'm looking at using JSONP.
I've successfully called and returned info, but I can't seem to do anything with the returned data.
My call is as so:
$http.jsonp('http://heavymetalhamilton.ca/wp-json/hmh-api/shows?_jsonp&callback=JSON_CALLBACK')
.success(function(data) {
console.log(data);
});
However, nothing is being logged. I can see that the $http.jsonp call is returning data (I can see in developer tools and looks like this:
/**/([{"ID":30,"post_date":"2014-09-25 18:33:15","post_date_gmt":"2014-09-25
...
)
I see that the returning data has some packing around it, but I'm not sure how to process this data.
Any help?
EDIT: Have what's happening going on in a CodePen
$http.jsonp('…').error(function (data, status, headers, config) { … … })- Michał Miszczyszyn