7

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

best
  • 167
  • 1
  • 1
  • 13
  • 1
    Are you sure your local path is correct? The CDN link to notify.js also leads to a 404. – Rory McCrossan Nov 09 '16 at 15:40
  • 2
    Do you need to load jquery before notify? Is it a dependency? – ste-fu Nov 09 '16 at 15:56
  • Yes @RoryMcCrossan CDN is leading to 404, Thanks for the same.And have updated the question accordingly. – best Nov 09 '16 at 16:34
  • 1
    Possible duplicate of [JavaScript error: "is not a function"](http://stackoverflow.com/questions/9825071/javascript-error-is-not-a-function) – Liam Nov 09 '16 at 16:35
  • Or [TypeError: "x" is not a function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_function) – Liam Nov 09 '16 at 16:36

2 Answers2

7

Invert a declaration

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

My problem was what in function load(), I loaded another jquery.js

Vitalicus
  • 1,188
  • 13
  • 15