我有有交易的名單表,我試圖做在設定的時間間隔更新表的內容。我在Linux紅帽服務器上運行這個頁面。這只是AJAX現在不能正常工作。無法獲得AJAX腳本工作
<!doctype html>
<html>
<head>
<script>
function updateTrans() {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.HTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("transactions").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "update_trans.txt", true);
xmlhttp.send();
}
window.setInterval(updateTrans(), 4000);
</script>
<link href="trans_styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1 id="heading"> Chomp The Bit </h1>
<div id="transactions">
<table id="trans_tbl" border="0">
<tr>
<th colspan="2">Latest Transactions</th>
</tr>
<tr>
<td>aaaaaaaaaaaaaaaaaaaaaaaaaaaaa</td>
<td>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</td>
</tr>
<tr>
<td>bbbbbbbbbbbbbbbbbbbbbbbbbbbbb</td>
<td>bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb</td>
</tr>
<tr>
<td>ccccccccccccccccccccccccccccc</td>
<td>cccccccccccccccccccccccccccccc</td>
</tr>
<tr>
<td>ddddddddddddddddddddddddddddd</td>
<td>dddddddddddddddddddddddddddddd</td>
</tr>
<tr>
<td>eeeeeeeeeeeeeeeeeeeeeeeeeeeee</td>
<td>eeeeeeeeeeeeeeeeeeeeeeeeeeeeeee</td>
</tr>
<tr>
<td>fffffffffffffffffffffffffffff</td>
<td>ffffffffffffffffffffffffffffffff</td>
</tr>
<tr>
<td>ggggggggggggggggggggggggggggg</td>
<td>gggggggggggggggggggggggggggggggg</td>
</tr>
<tr>
<td>hhhhhhhhhhhhhhhhhhhhhhhhhhhhh</td>
<td>hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh</td>
</tr>
<tr>
<td>iiiiiiiiiiiiiiiiiiiiiiiiiiiiii</td>
<td>iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii</td>
</tr>
<tr>
<td>jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj</td>
<td>jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj</td>
</tr>
</table>
</div>
</body>
</html>
你怎麼知道有什麼問題?你有什麼錯誤嗎? – acdcjunior
它不會改變任何內容..當我簡化Ajax和採取一些東西出來,JavaScript的工作,並得到了DIV部分,但它不與文本文件 – nacy
我的內容取代它......我不知道任何jQuery的,但..還有,這些交易不會被從數據庫中來..這將是從比特幣網絡 – nacy