Search code examples
.netjgrowl

Programming "turn on-off" JGrowl feature


I want to use JGrowl in my .Net MVC website. But I want the user to be able to turn it on off. Is there some kind of pattern for this functionality? Or is it just to make a if() and a database call on every pageload to check if the feature is on or off?

Thanks


Solution

  • There is nothing built into jGrowl to do this. Most implementations I've seen add their own polling ontop of jGrowl and control it from within that implementation. You don't need to store it in the database either, you could use a cookie or even local storage as an alternative.

    If you want to toggle this in real time without a reload you will want to use $.fn.jGrowl('create')and $.fn.jGrowl('shutdown') to control the starting and stopping of your jGrowl instance.