gpt4 book ai didi

javascript - 超时-Dialog.js 问题

转载 作者:行者123 更新时间:2023-12-03 07:07:09 25 4
gpt4 key购买 nike

我正在实现Timeout-Dialog.jsASP.NET MVC 5 项目中。

所以在我的布局页面上我有

 <script type="text/javascript" language="javascript">

$(function () {
Timer();
});

function Timer() {
console.log("Set Timeout");
setTimeout(TimeOut, 10000);
}

function TimeOut() {
$.timeoutDialog({
timeout: 1,
countdown: 60,
keep_alive_url: '@Url.Action("KeepAliveSession", "Account")',
logout_redirect_url: '@Url.Action("Login", "Account")',
logout_url: '@Url.Action("LogOff", "Account")',
restart_on_yes: true
});
}
</script>

我将所有文件包含到 BundleConfig 中。

   public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui.min.js",
"~/Scripts/jquery.dataTables.min.js",
"~/Scripts/dataTables.jqueryui.min.js ",
"~/Scripts/timeout-dialog/js/timeout-dialog.js"
));

bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css",
"~/Content/main.css",
"~/Content/jquery.dataTables.min.css",
"~/Content/jquery-ui.css",
"~/Content/dataTables.jqueryui.min.css",
"~/Scripts/timeout-dialog/css/timeout-dialog.css"

));

该对话框及时出现,但是当我按任何按钮时,我都会遇到此错误。

Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'close'

enter image description here知道如何修复它吗?

最佳答案

请引用: documentation

问题出在插件Timeout-Dialog.js

将插件中的 $(this).dialog('close') 替换为 $('#timeout-dialog').dialog('close');

关于javascript - 超时-Dialog.js 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36773204/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com