First off, I'm using angular js. I get syntax error that says missing ; before statement inside my console when trying to run the following function:
app.factory('behanceData', function($http){
var factory = {},
baseURL = 'http://www.behance.net/v2/',
user = 'EnokMadrid',
apiKey = 'wXg9JwtvGepF60zwE9f0t20YN4TGKxYc';
factory.myCallbackFunction = function(data){
// returning from async callbacks is (generally) meaningless
console.log(data);
return data;
}
var url = baseURL + "users/" + user + "/projects?api_key=" + apiKey;
$http.jsonp(url);
return factory;
});
In the behance api documentation states that the API will respond with:
myCallbackFunction({
...
})
So thats what I'm calling the function. In the angular js documentation it states that JSON_CALLBACK needs to be used. So if I add the following at the end of my url: ' ?jsonp=JSON_CALLBACK ' or ' &callback=myCallbackFunction ' ...I still get a bigger Network connection error.
What should I do to fix this issue? I'm completely fustrated and just want this code to work.