在微信小程序中调用本地接口

时间:2019-01-06 00:04:36   收藏:0   阅读:703

1.点击详情,并勾选项目设置中最后一行。

技术分享图片

技术分享图片

 

2.用小程序请求本地的后台服务接口

wx.request({  
      url: ‘http://localhost:8090/DemoProject/myTest.do‘,  
      data:{},  
      method:‘POST‘,  
      header: {  
        ‘content-type‘: ‘application/x-www-form-urlencoded‘  
      },  
      success: function (res) {  
        console.log(res.data)  
      }  
    })

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!