微信小程序开发POST请求
2016-11-09 17:17
477 查看
onLoad: function() { that = this; wx.request( { url: "http://op.juhe.cn/onebox/weather/query", header: { "Content-Type": "application/x-www-form-urlencoded" }, method: "POST", //data: { cityname: "上海", key: "1430ec127e097e1113259c5e1be1ba70" }, data: Util.json2Form( { cityname: "上海", key: "1430ec127e097e1113259c5e1be1ba70" }), complete: function( res ) { that.setData( { toastHidden: false, toastText: res.data.reason, city_name: res.data.result.data.realtime.city_name, date: res.data.result.data.realtime.date, info: res.data.result.data.realtime.weather.info, }); if( res == null || res.data == null ) { console.error( '网络请求失败' ); return; } } }) }
相关文章推荐
- 微信小程序开发之大坑记之post请求
- 微信小程序开发之大坑记之post请求
- 微信小程序开发之get请和post请求的两种用法
- 微信小程序开发之网络请求(POST请求)
- 微信小程序开发之网络请求(POST请求)
- 微信小程序开发之网络请求(POST请求)
- 微信小程序开发之大坑记之post请求
- 微信小程序开发之网络请求(POST请求)
- 解决·微信小程序开发-网络请求报Invalid request 400错误
- 微信小程序基本的开发框架抽取,包括网络请求的二次封装,页面状态管理,常见页面模板封装
- 微信小程序踩坑录(canvas、post请求不生效、页面刷新)
- 微信小程序之网络请求(POST请求)
- 微信小程序发送POST请求参数格式
- 微信小程序POST请求参数传递不到后台解决方案
- 微信小程序开发填坑,优雅地处理用户的误操作引起的多次请求
- 微信小程序 POST请求(网络请求)详解及实例代码
- 微信小程序开发之网络请求(GET请求)
- 微信小程序跳坑(一)---Post请求
- 微信小程序开发之网络请求(GET请求)
- 微信小程序开发(request请求后台获取不到data)