wx.request请求如何判断请求已发出?服务端要返回什么样格式的数据?
发布于 5 年前 作者 cyi 7060 次浏览 来自 问答

 wx.request请求获取数据,服务端要返回什么样格式的数据?为什么我在Js里请求获取,但实际上服务器端没收到请求。。。

如何判断请求已发出?服务端要返回什么样格式的数据?

Page({  data: {

      rows: []

      },

     onLoad: function () {

           var that = this; 

           //alert(“test”);

           wx.request({

             url: ‘https://test.com/gr/table_to_json.jsp’,

             data: {

                      sql: ‘select user_id,work_date,work_time from user’ 

                    },

             method: ‘post’,  

             header: {

                ‘content-type’: ‘application/x-www-form-urlencoded’

             },

             success:function(res) {

              that.setData({

                             rows: res.data.rows

                           })

              }

         })         

           //console.log(‘onLoad’)

     }

     })

1 回复

开发者服务器接口地址,一定要https吗,不能使用服务器ip吗?

回到顶部