html52.com
我爱小程序-开发者交流社区

wx.request 返回类型转不了json

问题模块
API和组件

 wx.request({

            url: tmpUrl,

            data: { code: code },

            dataType: 'json',

            success: function (res2) {

              var tmpObj = new Object();

              console.log(typeof (tmpObj));

              tmpObj = (res2.data);

              console.log('====44444' + tmpObj);

              console.log(typeof (tmpObj));

              console.log('=======' + tmpObj.con);

});


第二个typeof (tmpObj) 微信开发工具是object类型, 手机上就是string类型。 JSON.parse也转不了。   我把服务器php文件转为utf-8无BOM格式 也不行。


网友回复

Man:

电脑上log出来是这样{con: "ok", gid: "19900"}  手机上是 {"con": "ok", "gid": "19900"}

麦琪:

把返回内容贴出来

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付