Skip to content

Instantly share code, notes, and snippets.

@thaenor
Created January 22, 2015 13:51
Show Gist options
  • Save thaenor/10ccaeba94d634a7d2fc to your computer and use it in GitHub Desktop.
Save thaenor/10ccaeba94d634a7d2fc to your computer and use it in GitHub Desktop.
Angular Ajax Request
<!DOCTYPE html>
<html>
<head>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
</head>
<body>
<div ng-app="" ng-controller="customersController">
<ul>
<li ng-repeat="x in names">
{{ x.Name + ', ' + x.Country }}
</li>
</ul>
</div>
<script>
function customersController($scope,$http) {
$http.get("http://www.w3schools.com//website/Customers_JSON.php")
.success(function(response) {$scope.names = response;});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment