TypeError:self.options.theme未定义

时间:2013-07-01 12:57:36

标签: jquery jquery-plugins

我在项目中包含了jquery noty,但是在js文件TypeError: self.options.theme is undefined的这一行中我收到以下错误self.options.theme.style.apply(self); 我用谷歌搜索但没有成功。

  <script>
    $(document).ready(function () {

        $("#Send").click(function () {
            $.ajax({
                type: "POST",
                url: "RetrievePassword.aspx/SendNewPassword?email=" + $("#Email").val(),
                contentType: "application/json;charset=utf-8",
                success: function (result) {
                    //alert(result.d);
                    var n = noty({
                        text: 'A new password has been mailed', theme: 'default', layout: 'center', type: 'success', timeout: 3000, callback: {
                            onClose: function () {
                            }
                        }
                    });
                    window.location.href = 'Login.aspx';
                },
                error: function (response) {
                    var n = noty({ text: "An error occurred, either the email does not exists or is incorrect.", theme: 'default', layout: 'center', type: 'error', timeout: 2000 });
                }
            });
        });
    });
</script>

1 个答案:

答案 0 :(得分:1)

确保包含Noty所有必需的JS文件,我怀疑你没有指定主题:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>

<script type="text/javascript" src="js/noty/jquery.noty.js"></script>

<script type="text/javascript" src="js/noty/layouts/top.js"></script>
<script type="text/javascript" src="js/noty/layouts/topLeft.js"></script>
<script type="text/javascript" src="js/noty/layouts/topRight.js"></script>
<!-- You can add more layouts if you want -->

<script type="text/javascript" src="js/noty/themes/default.js"></script>