axios url params code example
Example 1: AXIOS CDN
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
Example 2: axios pass params
const axios = require('axios');
const res = await axios.get('https://httpbin.org/get', { params: { answer: 42 } });
res.data.args;
Example 3: how to send data in query param in axios in get request
const res = await axios.get('https://httpbin.org/get', { params: { answer: 42 } });
Example 4: axios
const axios = require('axios');
axios.get('/user?ID=12345')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
})
.then(function () {
});
axios.get('/user', {
params: {
ID: 12345
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
})
.then(function () {
});
async function getUser() {
try {
const response = await axios.get('/user?ID=12345');
console.log(response);
} catch (error) {
console.error(error);
}
}
Example 5: axios
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>