mvc 2中的Jquery-idletimeout错误

时间:2010-12-09 06:11:17

标签: jquery asp.net-mvc-2

在我的mvc应用程序中,在特定页面上,我使用jquery idletimeout插件进行会话。在我的jquery中,我收到的错误为'expected ')'。有谁知道我应该在哪里改变它?

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<title>ManageEmployeeProfile</title>
<script>
function logout() 
{ 
alert('You are about to be signed out due to Inactivity'); 
window.location = '/Account/Logout'; 
} 

$(document).ready(function() 
{   
 var SEC = 10; 
 var MIN = 6 * SEC; 
 // http://philpalmieri.com/2009/09/jquery-session-auto-timeout-with-prompt/ 
 <% if(HttpContext.Current.User.Identity.IsAuthenticated) {%> 
 $(document).idleTimeout({ 
    inactivity: 30 * MIN, 
    noconfirm : 30 * SEC, 
    redirect_url: 'javascript:logout()', 
    sessionAlive: 0, // 30000, //10 Minutes 
    click_reset: true, 
    alive_url: '', 
    logout_url: '' 
    }); 
 <%} %> 
}
</script>

1 个答案:

答案 0 :(得分:1)

失踪); for $(document).ready(function(){...} ---&gt;);

$(document).ready(function()

{

 var SEC = 10; 
 var MIN = 6 * SEC; 
 // http://philpalmieri.com/2009/09/jquery-session-auto-timeout-with-prompt/ 
 <% if(HttpContext.Current.User.Identity.IsAuthenticated) {%> 
 $(document).idleTimeout({ 
    inactivity: 30 * MIN, 
    noconfirm : 30 * SEC, 
    redirect_url: 'javascript:logout()', 
    sessionAlive: 0, // 30000, //10 Minutes 
    click_reset: true, 
    alive_url: '', 
    logout_url: '' 
    }); 
 <%} %> 
});