没流泪,不代表没眼泪;无所谓,不代表无所累。这个世界本就邋遢,所以没有什么可怕。每个人都有无法发泄的苦涩,都有无力排解的抑郁,而生活在那里的我们,哪一个不是拼尽全力,甚至不择手段地活着。
微信小程序 网络请求
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( '网络请求失败' );
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'
}, // 设置请求的 header
success: function(res){
that.data.items= res.data
},
fail: function() {
// fail
},
complete: function() {
// complete
}
})
}
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
以上就是微信小程序 网络请求(post请求,get请求)。这个时代传奇的男女,必要经历许多分分合合,辜负过很多人、也被很多人辜负过,然后在世人的议论纷纷中永垂不朽。扛得住诋毁,才担得起成功。经得起流言,才写得出传奇。更多关于微信小程序 网络请求(post请求,get请求)请关注haodaima.com其它相关文章!