[英]PUT/POST request sending without data
I have a client which makes the following request to a Pyramid Service.我有一个客户端向 Pyramid 服务发出以下请求。
var sendArr = {"hello": "world"};
$.ajax({
type: "PUT",
contentType: "application/json",
url: "http://0.0.0.0:6543/" + obj.id + newUrlSegment,
data: sendArr,
headers: { 'X-User-Email': loggedUser.user, "X-Auth-Token": loggedUser.token},
success: function(data,status,other){
console.log("server return", data);
},
error: function (XMLHttpRequest, textStatus, errorThrown){
console.log(errorThrown);
},
});
The request is received by the server, however the request 'data' is missing.服务器收到请求,但缺少请求“数据”。
Is there any particular reason why the data is not being attached client-side?数据没有附加到客户端是否有任何特殊原因?
If you use:如果您使用:
data: JSON.stringify(sendArr)
It should work.它应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.