微信小程序请求方法

  1.  wx.request({  
  2.       url: 'http://xx.xxxxx.com/xxx.php',//上线的话必须是https,没有appId的本地请求貌似不受影响  
  3.       data: {},  
  4.       method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT  
  5.       // header: {}, // 设置请求的 header  
  6.       success: function(res){  
  7.         console.log(res.data.result)  
  8.         that.setData({  
  9.           Industry:res.data.result  
  10.         })  
  11.       },  
  12.       fail: function() {  
  13.         // fail  
  14.       },  
  15.       complete: function() {  
  16.         // complete  
  17.       }  
  18.     })  
posted on 2017-06-08 10:45  杨廷贯  阅读(198)  评论(0编辑  收藏  举报