axios how to code example
Example 1: axios cdn
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
Example 2: axios post
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Example 3: axios get
import axios from 'axios';
await axios.get('/user', {
params: {
ID: 12345
}
})