I'm trying to receive data in AngularJs via JSONP using the $http.jsonp(url)
. I'm new to AngularJs and Javascript in general. What am I doing wrong?
This is the code I used:
angular.module('tutorialApp', []).controller('ContentCtrl', function($scope, $http){
var url = "/somejsonp.jsonp?callback=JSON_CALLBACK";
$http.jsonp(url)
.success(function(data){
console.log(data);
});
});
I keep getting:
Uncaught ReferenceError: jsonCallback is not defined
My jsonp looks like this:
jsonCallback([
{
"from": "Lissabon (LIS)",
"to": "Bangkok (BKK)",
},
{
"from": "Hamburg (HAM)",
"to": "Vienna (VIE)",
}
]);