2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-27 14:47:43 +03:00

Improving the response API

This commit is contained in:
Matt Zabriskie
2014-08-29 16:09:40 -06:00
parent 1c35eaadc0
commit d441f8392f
11 changed files with 38 additions and 29 deletions
+4 -4
View File
@@ -58,10 +58,10 @@
<script src="../dist/axios.min.js"></script>
<script>
axios.get('people.json')
.success(function (response) {
.success(function (data) {
var people = [];
response.data.forEach(function (person) {
data.forEach(function (person) {
people.push(
'<li>' +
'<img src="https://avatars.githubusercontent.com/u/' + person.avatar + '?s=50"/>' +
@@ -74,8 +74,8 @@
document.getElementById('people').innerHTML = people.join('');
})
.error(function(response) {
document.getElementById('people').innerHTML = '<li class="error">' + response.data + '</li>';
.error(function(data) {
document.getElementById('people').innerHTML = '<li class="error">' + data + '</li>';
});
</script>
</body>