0

我正在从https://github.com/ehynds/jquery-idle-timeout开发一个简单的 sessionTimeOut 插件,奇怪的问题是它在我的一个应用程序上工作得非常好,但在第二个应用程序上却没有

以下是页面加载时我在第二个应用程序上遇到的错误。

Uncaught TypeError: Cannot read property 'nodeType' of undefined jquery.min.js:4
>   b.extend.acceptData jquery.min.js:4
>   P jquery.min.js:4
>   b.extend.data jquery.min.js:4
>   idleTimeout.init jquery.idletimeout.js:32
>   $.idleTimeout jquery.idletimeout.js:139
>   (anonymous function) Login:122

这是代码:

    <script src="~/Scripts/Lib/Kendo/jquery.min.js"></script>

    <!--Calling the JQuery UI for dialog box usid in sessionTimeOut -->
<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="~/Scripts/Custom/jquery.idletimeout.js"></script>
<script src="~/Scripts/Custom/jquery.idletimer.js"></script>

        <script type="text/javascript">
        // setup the dialog
        $("#dialog").dialog({
            autoOpen: false,
            modal: true,
            width: 400,
            height: 210,
            closeOnEscape: false,
            draggable: false,
            resizable: false,
            buttons: {
                'Yes, Keep Working': function () {
                    $(this).dialog('close');
                },
                'No, Logoff': function () {
                    // fire whatever the configured onTimeout callback is.
                    // using .call(this) keeps the default behavior of "this" being the warning
                    // element (the dialog in this case) inside the callback.
                    $.idleTimeout.options.onTimeout.call(this);
                }
            }
        });

        // cache a reference to the countdown element so we don't have to query the DOM for it on each ping.
        var $countdown = $("#dialog-countdown");

        // start the idle timer plugin
        $.idleTimeout('#dialog', 'div.ui-dialog-buttonpane button:first', {
            idleAfter: 6,
            pollingInterval: 2,
            serverResponseEquals: 'OK',
            onTimeout: function () {
                window.location = "/Home/Index/";
            },
            onIdle: function () {
                $(this).dialog("open");
            },
            onCountdown: function (counter) {
                $countdown.html(counter); // update the counter
            }
        });

</script>

如果您需要任何其他信息,请告诉我!

我不确定我错过了什么......请提出建议!

4

0 回答 0