2 回答
TA贡献1775条经验 获得超11个赞
问题是调用没有在正文中发送请求数据 [但不知何故curl工作正常]。当我尝试获取body, err := ioutil.ReadAll(r.Body)它时,它给出了空值。所以我改变了从r.Form
r.ParseForm()
var body []byte
for key, _ := range r.Form {
body = []byte(key)
break
}
r.Form给一张地图。所以我正在遍历地图并获取 req 数据。这个SO帖子给出了解决方案。可能对其他人有帮助:)
TA贡献1836条经验 获得超4个赞
您的数据已在 console.log 中字符串化
time = new Date($.now());
requestJSON = '{"Method":"GET","AppName":"Proline","ServiceURL":"http://localhost:8081/api/services/tags/","Properties":null,"Object":"","Timestamp":"'+time+'"}'
$.ajax({
type: "GET",
url: "http://localhost:8081/api/services/tags/",
data:JSON.stringify(requestJSON),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data){alert(data);},
failure: function(errMsg) {
alert(errMsg);
}
});
- 2 回答
- 0 关注
- 139 浏览
添加回答
举报