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的迴應?
謝謝。