未捕获的ReferenceError:noty未定义

问题描述 投票:0回答:1

我遇到了一个问题,即使用noty插件无法显示通知。我在ASP.net Web应用程序中包含了这个插件。

_Layout.cshtml

<link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
<link href="~/lib/bootstrap-table/dist/bootstrap-table.css" rel="stylesheet" /> 
<link href="~/css/site.css" rel="stylesheet" />
<link rel="stylesheet" href="~/css/sticky_footer.css" />
<link href="~/lib/noty/lib/noty.css" rel="stylesheet" />

<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
<script src="~/lib/jquery-validation/dist/additional-methods.js"></script>
<script src="~/lib/js-cookie/src/js.cookie.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="~/lib/bootstrap-table/dist/bootstrap-table.js"></script>
<script src="~/lib/noty/lib/noty.js"></script>
<script src="~/lib/moment/min/moment.min.js"></script>
<script src="~/lib/he/he.js"></script>
<script src="~/lib/bootstrap-table-contextmenu/dist/bootstrap-table-contextmenu.min.js"></script>

Create.cshtml

 $updateSessionSynopsisHandler.done(function (data, textStatus, jqXHR) {
            noty({
                text: data.message, type: 'success',
                layout: 'center'
            });

        });

错误enter image description here

javascript jquery asp.net notifications noty
1个回答
2
投票

正如在Noty document中所写,我认为Noty是一个构造函数。它应该在您想要使用之前进行实例化。试试这个

$updateSessionSynopsisHandler.done(function (data, textStatus, jqXHR) {
        new Noty({
            text: data.message, type: 'success',
            layout: 'center'
        }).show();
    });
© www.soinside.com 2019 - 2024. All rights reserved.