Page({
/**
* 页面的初始数据
*/
data: {
title:'第一个页面',
desc:'哈喽,小鱼'
},
test:function() {
wx.request({
url:'http://localhost:8086/ssm/wx',
data: {
id:'12',
name:'微信小程序'
},
method:'get',
header: {
'content-type':'application/json'// 默认值
},
fail:function() {
console.log("失败了")
}
})
}
}
)
res.setContentType("text/json;charset=UTF-8");
res.setCharacterEncoding("UTF-8");
req.setCharacterEncoding("utf-8");
res.setHeader("Access-Control-Allow-Orgin", "*");
res.setHeader("Access-Control-Allow-Methods", "POST,GET");
String id=req.getParameter("id");
String name=req.getParameter("name");
System.out.println(id+name);
求各位大神帮忙看一下,在开发者工具里,id+name可以在eclipse控制台接受,到了真机调试(用的华为荣耀9),点了按钮,却跑到了fail。