mouse0270 / bootstrap-notify

Turns standard Bootstrap alerts into "Growl-like" notifications.
http://bootstrap-notify.remabledesigns.com/
MIT License
2.25k stars 641 forks source link

Using plugin inside another function : $.notify undefined #163

Closed Rezrazi closed 2 years ago

Rezrazi commented 7 years ago

When used the plugin this way, it works perfectly

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mouse0270-bootstrap-notify/3.1.7/bootstrap-notify.min.js"></script>
<script>
    $.notify({
        // options
        message: 'Hello World'
    }, {
        // settings
        type: 'danger'
    });
</script>

but I want to define a javascript function that call the plugin, so as to define custom options for notify depending on usage I've been trying this

<script>
    function sendNotification() {
        $.notify({
            // options
            message: 'Hello World'
        }, {
            // settings
            type: 'danger'
        });
    }
</script>

When calling the function from chrome devtools, it throws a $.notify is not defined error

Sidharthan1988 commented 7 years ago

can anyone let me know if this will work ..any work around is available

ramunozp commented 7 years ago

Very bad, I'm trying to do the same thing and it does not work anywhere. Definitely this is not going to solve, we will have to change plugins.