这是一段代码(基于W3Schools的一个例子),它使用Javascript定期更新页面:
<!DOCTYPE HTML>
<html>
<head>
<title>Timer test</title>
<script>
var myVar=setInterval(function () {myTimer()}, 1000);
function myTimer() {
var d = new Date();
document.getElementById("timeNow").innerHTML = d.toLocaleTimeString();
}
</script>
</head>
<body>
<h1>The time now is <span id="timeNow"></span></h1>
</body>
</html>
纯Ruby / Rails中是否有等效的定期更新“timeNow”span元素?