执行两个AJAX帖子,两者在大多数浏览器,手机上都能正常运行,但在Safari或者隐身模式下无法正常运行。这是显示错误的错误:
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');
});
先谢谢你。