SoFunction
Updated on 2025-04-04

Vuejs uses axios asynchronous access to examples using get and post

in script.

let data={....};

let url=xx;

Different methods:

GET:

this.$(url,{
    params:data
   })
   .then(function (res) {
    ()
   })
   .catch(function (error) {
    (error)
   })

POST:

Method 1: 1.

  //Convert parameters before requesting background data
 
let url = xx; 
let data = {
    uname:,
    upwd:,
    pid:
   };
 function transformRequest(data) {
   let ret = ''
   for (let it in data) {
    ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
   }
   return ret
 }
   let p = transformRequest(data)
   this.$(url,p)
   .then(function (res) {
    ()
   })
   .catch(function (error) {
    (error)
   })

Method 2: 2

var qs = require('qs');
this.$(url,(data))
   .then(function (res) {
    ()
   })
   .catch(function (error) {
    (error)
   })

Is this.$ajax renamed by modifying the vue prototype or axios?

The above example explanation of using get and post when using axios asynchronous access of vuejs is all the content I share with you. I hope you can give you a reference and I hope you support me more.