Created
March 3, 2019 01:00
-
-
Save eichgi/97692fb19ad9a210e2098a502d8b3aa7 to your computer and use it in GitHub Desktop.
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"></script> | |
<script> | |
//axios.get('http://patterns.test/practice/ajax/process.php') | |
axios.get('http://patterns.test/practice/ajax/json.js') | |
.then(function (res) { | |
console.log(res.data[1].name); | |
}); | |
</script> | |
</body> | |
</html> |
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
[{"name":"Hiram","age": "28"},{"name":"Eduardo","age":"34"}] |
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
<?php | |
$array = [ | |
[ | |
'name' => 'Hiram', | |
'age' => 28, | |
], | |
[ | |
'name' => 'Eduardo', | |
'age' => 34, | |
] | |
]; | |
echo json_encode($array); | |
//[{"name":"Hiram","age":28},{"name":"Eduardo","age":34}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment