欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序 網(wǎng)絡(luò)請求(post請求,get請求)

 更新時(shí)間:2017年01月17日 14:57:04   投稿:lqh  
這篇文章主要介紹了微信小程序 網(wǎng)絡(luò)請求(post請求,get請求)的相關(guān)資料,需要的朋友可以參考下

微信小程序 網(wǎng)絡(luò)請求

1.post請求:

onLoad: function() { 
  that = this; 
  wx.request( { 
   url: "url", 
   header: { 
    "Content-Type": "application/x-www-form-urlencoded" 
   }, 
   method: "POST", 
   data: {}, 
   complete: function( res ) { 
    console.log(res.data)
    }); 
    if( res == null || res.data == null ) { 
     console.error( '網(wǎng)絡(luò)請求失敗' ); 
     return; 
    } 
   } 
  }) 
 }, 

2.GET請求

onLoad: function () {
  console.log('onLoad')
  var that = this
   wx.request({
   url: 'http://json.bmbstack.com/cinemaList',
   data: {},
   method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
    header: {
   'Accept': 'application/json' 
    }, // 設(shè)置請求的 header
   success: function(res){
    that.data.items= res.data
   },
   fail: function() {
    // fail
   },
   complete: function() {
    // complete
   }
  })
 }

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論