微信小程序 网络API发起请求详解

(编辑:jimmy 日期: 2024/10/2 浏览:2)

微信小程序 网络API:

微信小程序 网络API发起请求

微信小程序 网络API 上传、下载

微信小程序 网络API Websocket

微信小程序 wx.request(OBJECT)

"开发者服务器返回的内容"} fail Function 否 接口调用失败的回调函数 complete Function 否 接口调用结束的回调函数(调用成功、失败都会执行)

示例代码:

wx.request({
 url: 'test.php',
 data: {
  x: '' ,
  y: ''
 },
 header:{
  "Content-Type":"application/json"
 },
 success: function(res) {
  var data = res.data;
 }
});

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!