数時間前にこれを探していますが、どこにも見つかりません。
シンプルな Jquery スクリプトを使用して div を更新します。その div に PHP の出力を表示したいと考えています。
$script = "
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></script>
<script type=\"text/javascript\">// <![CDATA[
$(document).ready(function() {
$.ajaxSetup({ cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never refresh
setInterval(function() {
$('#uziRefresh').load('http://mypage/refresh.php?a_a=".$kinek[1]."');
}, 6000); // the \"3000\" here refers to the time to refresh the div. it is in milliseconds.
});
// ]]></script>
";
私の問題です。リフレッシュするとdivスクロールの先頭位置に移動します。ユーザーがdivのすべてのコンテンツを読みたいので、現在の位置を維持したいと思います。簡単なチャットアプリを作りたいです。しかし、常にトップに行くのは悪いことです。
どうすればこれを解決できますか? 誰にも解決策がありますか?