Microsoft Webmatrix 環境で div の更新を実装しようとしています。私はcshtml Webページを準備しています。次のコードを使用します。
@{
}
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
setInterval("my_function();",1000);
function my_function(){
$("#refresh").load(location.href + '#time');
}
</script>
</head>
<body>
<div id="refresh">
<div id="time"> Today is @DateTime.Now </div>
</div>
</body>
残念ながら、それは機能しません。「時間」divの実際の時間を更新しません。コードのどこに間違いがありますか? Arturさん、よろしくお願いします。