1
我對網頁設計非常陌生,我需要幫助解決我現在遇到的問題。我在Django的幫助下編寫了一個網頁,它將數據從MySQL數據庫中提取出來,並使用嵌入式for循環將它們放在網頁上。數據庫中的值會不斷更新,並在顯示新值時刷新頁面。這種方法看起來非常笨重,我想知道是否有簡單的方法讓他們更新而不刷新?在不刷新的情況下更新Django中的值
!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0.5">
<link rel="stylesheet" href="css/style.css">
<link href="images/favicon.ico" rel="shortcut icon">
<title>Health monitor</title>
</head>
<body>
<div class="container">
<h1>Health Monitor</h1>
<h2>Temperature Data</h2>
{% for heat in temp %}
<h3>Current temperature {{ heat.hot }} </h3>
<p>You might want to call a nurse</p>
{% endfor %}
看到這個http://stackoverflow.com/questions/4644027/auto-reload-web-page – kartheek 2013-03-26 13:30:47