使用JQuery在不重新加载页面的情况下自动刷新内容?
我有一个显示表内容的jsp页面。 当用户查看一个页面时,表的内容会一秒一秒地改变。 因此,用户必须每次刷新页面才能看到新的和更新的内容。 如何在不刷新页面的情况下更新jsp页面的内容 这是我的密码 它不会工作。请给我你的建议,如果没有给一个样本代码谢谢 index.jsp使用JQuery在不重新加载页面的情况下自动刷新内容?,jquery,jsp,Jquery,Jsp,我有一个显示表内容的jsp页面。 当用户查看一个页面时,表的内容会一秒一秒地改变。 因此,用户必须每次刷新页面才能看到新的和更新的内容。 如何在不刷新页面的情况下更新jsp页面的内容 这是我的密码 它不会工作。请给我你的建议,如果没有给一个样本代码谢谢 index.jsp <html> <head> <Title>Just A Test</Title> <script type="text/javascript" src="ht
<html>
<head>
<Title>Just A Test</Title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_me').load('samp.jsp').fadeIn("slow");
}, 10000); // autorefresh the content of the div after
//every 10000 milliseconds(10sec)
</script>
</head>
<body>
<div id="load_me"> <%@ include file="samp.jsp" %></div>
</body>
/html>
要加载内容而不刷新页面,可以使用JQuery Ajax
有关更多信息,请使用JQuery Ajax加载内容而不刷新页面
更多信息我相信刷新会起作用,但这会违反超时策略我相信刷新会起作用,但这会违反超时策略下面的代码对我有效,请尝试一下,告诉我它是否对您也有效
<html>
<head>
<Title>Just A Test</Title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_me').load('samp.jsp').fadeIn("slow");
}, 1000); // autorefresh the content of the div after
//every 1000 milliseconds(1sec)
</script>
</head>
<body>
<div id="load_me"> <%@ include file="samp.jsp" %></div>
</body>
</html>
下面的代码对我有效,请尝试一下,并让我知道它是否也对你有效
<html>
<head>
<Title>Just A Test</Title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_me').load('samp.jsp').fadeIn("slow");
}, 1000); // autorefresh the content of the div after
//every 1000 milliseconds(1sec)
</script>
</head>
<body>
<div id="load_me"> <%@ include file="samp.jsp" %></div>
</body>
</html>
load是对ajax的传递,他已经在使用ajax了。上面的代码是用jsp编写的。有没有可能请给我编辑那个代码jQuery get函数而不是load呢?load是一个到ajax的过程,他已经在使用它了。上面的代码在jsp中工作吗。是否可能请给我编辑该代码jQuery get函数而不是load呢?您是否检查了fiddler或类似工具以查看samp.jsp返回的内容?上述代码是否在jsp中工作。是否可能请给我编辑该代码您是否检查了fiddler或类似工具以查看samp.jsp返回的内容?上述代码是否在jsp中工作。是否可能请给我编辑代码尼斯,但解释它多一点给用户2493093nice,但解释它多一点给用户2493093