Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What are the problem?
@Stchan

axiosでGET,POSTする

axios読み込み

    <script src="https://cdn.jsdelivr.net/npm/axios@0.20.0/dist/axios.js"></script>

GET

axios.get('/user?ID=12345')
.then(function (response) {
    // handle success
  console.log(response);
})
.catch(function (error) {
    // handle error
  console.log(error);
})
.finally(function () {
    // always executed
});

POST

const params = new URLSearchParams();
params.append('firstName', 'Mineo');
params.append('lastName', 'Okuda');
axios.post('post-api.php',params)
.then(function (response) {
    // handle success
  console.log(response);
})
.catch(function (error) {
    // handle error
  console.log(error);
})
.finally(function(){
})

参考

使い方

axiosとは
axiosライブラリを使って、柔軟にHTTP通信を行う

GET,POST

CDN版Vue.js + axios でさくっとAjaxしてみる

JSDELIVER

JSDELIVERのaxiosページ

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
1
Help us understand the problem. What are the problem?