0
我正在测试一个Ajax表单,并且我得到的行为并不是我期待的。该请求返回http 200 OK,但xhr状态为0,错误。我正在对requestb.in进行测试。jQuery Ajax请求200但状态错误
这里是我的功能(在CoffeeScript中):
$.ajax
type: 'POST'
url: 'http://requestb.in/1fcyas71'
dataType: 'json'
data: { foo: "bar" }
error: (xhr, status, error) ->
$('div#response').text(error).addClass('error')
console.log status
console.log xhr
success: (data, status, xhr) ->
$('div#response').text(data).removeClass('error')
console.log status
console.log xhr
我的理解是requestb.in接受任何要求,所以这是为什么返回的错误?
这是一个跨域请求? –
看起来像一个跨域..对于这样的请求,你必须使用jsonp或cors! –
是的,这是跨域requestb.in,也将是当我把真正的数据英寸 – Andrew