热门搜索 :
考研考公
您的当前位置:首页正文

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

来源:东饰资讯网

微信小程序中:


    wx.request({
      url: ‘https://.......‘,
      data: {},
      method: 'GET', 
      // header: {}, // 设置请求的 header
      success: function(res){
        // success
      },
      fail: function() {
        // fail
      },
      complete: function() {
        // complete
      }
    })

jquery中:

$.ajax({
      url: ‘https://.......‘,
      data: {},
      method: 'GET', 
      success: function(res){
        // success
      },
      error: function() {
        // fail
      },
      complete: function() {
        // complete
      }
    })

Top