axios post 请求

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  </head>
  <body>
    axios
    <script type="text/javascript">
    var params = new URLSearchParams();
    params.append('pageNo',1)
    params.append('pageSize',10)

    axios.post('/api/question/list', params,
      {
        headers: {
          'Content-Type':"application/x-www-form-urlencoded;charset=UTF-8"
        }
      }
    )
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
    </script>
  </body>
</html>

 

posted @ 2018-08-21 00:52  renyangli  阅读(125)  评论(0编辑  收藏  举报