使用Jquery刷新MVC视图页面

时间:2014-03-21 11:33:15

标签: javascript jquery html sql-server asp.net-mvc-3

如何刷新视图页面而不刷新jquery中的页面。

这是我的代码..请帮助解决它

<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>

1 个答案:

答案 0 :(得分:0)

也许你忘了执行你的函数'auto_refresh();' !

试试这个:

<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); // auto refresh the content of the div after
                    // every 10000 milliseconds(10sec)
     auto_refresh();
    </script>
 </head>
<body>
<div id="load_me"> <%@ include file="samp.jsp" %></div>
</body>
</html>