Read json data from URL
Description
The following code shows how to Read json data from URL.
Example
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!-- ww w . j av a 2s.c o m-->
<body>
<h1>Spotify with AngularJS (with callback)</h1>
<p>Open console</p>
<div ng-app ng-controller="spotify_api"></div>
<script type='text/javascript'>
// open console
function spotify_api($http) {
var url = "http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo";
$http.jsonp(url).success(function(data) {
console.log(data);
});
}
</script>
</body>
</html>