您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

微信小程序中的网络请求(post请求和get请求)

2024/6/26 0:26:25发布43次查看
这篇文章主要介绍了微信小程序 网络请求(post请求,get请求)的相关资料,需要的朋友可以参考下
微信小程序 网络请求
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 } }) }
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注!
相关推荐:
微信小程序request请求后台接口php的介绍
微信小程序的get请求的介绍
以上就是微信小程序中的网络请求(post请求和get请求)的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product