1
我尝试发送到httpbin要求与prototype.js中发送Ajax请求,并得到了prototype.js中响应
我的代码:
function loadTest()
{
new Ajax.Request('http://httpbin.org/get', { method:'get',
// success request
onSuccess:
function(transport) {
alert("Success! \n\n" + transport.status);
},
// fail request
onFailure:
function() {
alert('Something went wrong...');
}
});
}
执行后我得到:Success!
和transport.status = 0
为什么?我怎样才能正确发送请求,并得到与prototype.js的回应?
谢谢。