$.notify is not a function with Bootstrap in MVC after ajax call

best picture best · Nov 9, 2016 · Viewed 17.1k times · Source

I want to show a notify when an ajax function completes. My ajax is good I just can't seem to get the notify to work. I have jquery and everything installed and I also have notify.js. From the Chrome console I came to know the below error

Uncaught TypeError: $.notify is not a function

And also I am getting my ajax response fine. Below is the code for notifying,

@if (TempData.ContainsKey("SuccessMessage"))
{
    <script>
        $.notify({
            message: '@TempData["SuccessMessage"].ToString()'
        }, {
            type: 'success',
            delay: 7000,
        });
    </script>
}

And below is the references added for the same,

<script src="/bootstrap/js/notify.js"></script>
<script src="/scripts/js/jquery.min.js"></script>

Let me know if I am making any mistakes

Answer

Federico Zorzi picture Federico Zorzi · Oct 24, 2017

Invert a declaration

<script src="/scripts/js/jquery.min.js"></script>
<script src="/bootstrap/js/notify.js"></script>