微信小程序wx.request程序
来源:互联网 发布:java utf16转utf8 编辑:程序博客网 时间:2024/04/28 18:15
//// JSON.stringify(d)这个函数可以将JSON转为字符串。 var a = "读取失败"; wx.request({ url: 'https://****.ashx', header: { 'content-type': 'application/x-www-form-urlencoded' }, success: function (d) { /**正确时返回{"errMsg":"request:ok","data":{"error":1,"message":"获取商品列表失败!"},"header":{"Cache-Control":"private","Content-Length":"51","Content-Type":"text/html; charset=UTF-8","Server":"Microsoft-IIS/7.5","X-AspNet-Version":"4.0.30319","X-Powered-By":"ASP.NET","Date":"Sat, 01 Jul 2017 09:37:50 GMT"},"statusCode":200}*/ wx.showToast({ title: JSON.stringify(d), icon: 'success', duration: 2000 }) },fail(d) { ////提交错误时d返回{"errMsg":"request:fail"} wx.showToast({ title: JSON.stringify(d), icon: 'success', duration: 2000 }) } // , complete(d) {//这个优先于fail执行 // wx.showToast({ // title: '接口调用完成', // icon: 'success', // duration: 2000 // }) // } })
wx.request 服务器要求的https 的 tls版本要大于 1.2哦。这个在微信官方文档上BUG&tip错误与提示中有提到的
官方文档https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html
阅读全文
1 0
- 微信小程序wx.request程序
- 微信小程序 wx.request({})问题
- 微信小程序wx.request后台数据交互
- 微信小程序网络请求wx.request请求
- 微信小程序 wx.request()无返回结果
- 微信小程序 wx.request 的问题
- 微信小程序wx.request后台数据交互
- 微信小程序 wx.request wepy 简单封装
- 微信小程序-wx.request获取数据
- 微信小程序数据请求方法wx.request
- 微信小程序把玩(三十)wx.request(object) API
- 微信小程序的ajax数据请求wx.request
- 微信小程序 豆瓣项目中wx.request遇到的问题
- 微信小程序Swiper+wx.request 数据绑定刷新
- 微信小程序--wx.request使用psot传递数据
- 微信小程序wx.request接收服务器返回信息
- 微信小程序 wx.request 获取百度API token
- 微信小程序wx.request使用post方式传参
- MySQL 事务
- angularjs中的几种服务的详细分析(转)
- 逆序打印链表
- 生产力:编写属于你自己的日志分析器(2)
- Linux终端操作MySQL常用命令
- 微信小程序wx.request程序
- 算法资源清单
- tomcat发布多个项目时出现PermGen space(内存溢出)
- python3.x和python2.0语法方面的区别
- Sublime Text 如何关闭自动更新
- Intellij Idea @Autowired取消提示
- 模仿电影院座位预定效果
- 静态内部类、静态变量的加载次数-理解静态内部类实现线程安全的单例模式
- java邮件发送