djack109
djack109

Reputation: 1377

Notify after Ajax call

Hope this is an nice easy one I want to show a notify when an ajax function completes. My ajax is fine I just can't seem to get the notify to work. I have jquery and everything installed and I also have notify.js from http://notifyjs.com/.

Using the google developer tools I just get the error below all the time.

Uncaught TypeError: $.notify is not a function

Here is my ajax function. This works just fine exactly as I need just no notify is displayed :(

function MyAjaxFunction()
{
    var xmlhttp = new XMLHttpRequest();

    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById("mainpagemenu_myDiv").innerHTML = xmlhttp.responseText;
            $.notify("Hello World"); // <- **** this is the thing I want to do
        }
    }

    xmlhttp.open("POST", "/myaspfile.aspx", true);

    xmlhttp.send();           
}

I have linked in my files

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

and

<script src="/bootstrap/js/notify.js"></script>

Upvotes: 1

Views: 6311

Answers (1)

Menelaos Vergis
Menelaos Vergis

Reputation: 3935

Link to the following script

<script src="http://notifyjs.com/dist/notify-combined.min.js"></script>

at the top of the page (before using the Ajax function)

Upvotes: 1

Related Questions