Created
January 22, 2015 13:51
-
-
Save thaenor/10ccaeba94d634a7d2fc to your computer and use it in GitHub Desktop.
Angular Ajax Request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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