Use toastr alert on load


Topic: Use toastr alert on load

pbeks pro premium priority asked 6 years ago

Hi, is there a way to manipulate the toastr object without triggering the click() method of the buttons?I want to display a warning or error toast when the Session variable error or warning is set then I want to use the Value of error or warning as message. Anyone with some example or snippet ? Thanks in advance

Bartłomiej Malanowski staff pro premium answered 6 years ago

This should work:

$(function () {
    toastr["info"]("Welcome!");
});

pbeks pro premium priority commented 6 years ago

Sorry, I am new to this, how do I call Function from PHP then? Suppose I open index.php and have set Session var "error" to "Some Error text" and on load of the page display a TOASTR with the error text?

Bartłomiej Malanowski staff pro premium commented 6 years ago

Could you please show us your existing code?

pbeks pro premium priority answered 6 years ago

That solved the problem, Thanks.

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No