Javascript jQuery AJAX JSON post失败,但仅限于匿名或safari

Javascript jQuery AJAX JSON post失败,但仅限于匿名或safari,javascript,jquery,json,ajax,safari,Javascript,Jquery,Json,Ajax,Safari,做了两篇AJAX文章后,这两篇文章在大多数浏览器、手机上都能正常工作,但在safari或chrome incognito上则不行。这是显示以下内容的错误: fail www.sendsonar.com/api/v1/customers:1 POST POST https://www.sendsonar.com/api/v1/customers 400 (Bad Request) www.sendsonar.com/api/v1/messages:1 POST https://www.send

做了两篇AJAX文章后,这两篇文章在大多数浏览器、手机上都能正常工作,但在safari或chrome incognito上则不行。这是显示以下内容的错误:

fail
www.sendsonar.com/api/v1/customers:1 POST 
POST https://www.sendsonar.com/api/v1/customers 400 (Bad Request)
www.sendsonar.com/api/v1/messages:1 
POST https://www.sendsonar.com/api/v1/messages 400 (Bad Request)
你知道为什么会这样吗

以下是其中一个的代码片段:

$.ajax({
  dataType: 'json',
  beforeSend: function (request) {
    request.setRequestHeader("Token", "token-goes-here");
  },
  method: "POST",
  url: "https://www.sendsonar.com/api/v1/customers",
  data: JSON.stringify({
    'phone_number': phone,
    'email': email,
    'first_name': first_name
  }),
  contentType: "application/json; charset=utf-8"
}).success(function(data) {
  console.log('success');
}).fail(function(data) {
  console.log('fail');
});

请提前向您表示感谢。

该错误来自您的服务器。检查服务器日志或响应正文。我也有同样的问题,无法解决。