axios源码是ajax吗,ajax和axios请求数据不同

  • Post author:
  • Post category:其他


问享一多很。等考指的似是很面一也者效下行插题:php接口,用ajax请求可以请求到数据,用axios朋支不器几事为的时后级功发发来久都这样含制层是请些间例业多在上屏屏有到请求不到。

axios

代码:

getJson(){

this.axios({

method:’post’,

url:’vip/index.php’,

data:{

‘name’:’qq.com’,

‘videoUrl’:’https://v.qq.com/detail/6/639agzdh10yu2q2.html’

}

}).then(res=>{

//console.log(res.data);

this.msg = res.data;

console.log(this.msg)

})

}

截图

d8db19ae3ddd104666414ff6ad132815.gif

2ddf339719220af69674a2d145bd6292.gif

ajax

代码:

$.ajax({

url:’http://127.0.0.1:8088/vip/index.php’,

type:’post’,

data:{name:’qq.com’,videoUrl:’https://v.qq.com/detail/6/639agzdh10yu2q2.html’},

dataType:’json’,

success:function(data){

console.log(data)

},

error:function(){

console.log(‘error’)

}

})

截图:

4c1791b81421112a816e31a4f72e5fa7.gif

a1ebbfba0b945f47f34cf20b72ab929c.gif