以下代碼應該在頁面加載後執行AJAX請求,然後在彈出窗口中顯示該AJAX調用的響應。這在Firefox中起作用,但我不知道爲什麼它在IE8中不起作用。Prototype的Ajax.Request和Internet Explorer 8
<html>
<head>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript">
// Do this stuff when DOM finishes loading.
document.observe("dom:loaded", function() {
new Ajax.Request("page.html", {
onSuccess: function(response) {
alert(response.responseText);
}
});
});
</script>
</head>
<body>
</body>
</html>
page.html中只包含
hello world
我失去了一些東西明顯或這是原型JS庫不是與IE8完全兼容的結果?我用最新的穩定原型版本(1.6.0.3)和最新版本(1.6.1 RC3)嘗試了這個版本,但沒有運氣。任何幫助將不勝感激,謝謝!
這就是問題所在,非常感謝 – Matthew 2009-07-14 16:36:54