Search code examples
javascriptmeteoriron-router

Meteor iron-router .go without refreshing the site


I want to use Router.go('...') function to navigate via javascript after e.g. submitting form. Is it possible to do so without refreshing the whole site ? Refresh wouldn't be such a problem, problem is that refresh forces to quit all alerts, so e.g. when user submits form and everything went well, he will get alert and then I want to move him onto another site (with Router.go('...')), but after using this function site refreshes and alert quits. For alerts I'm using sAlert package.


Solution

  • There is an onClose callback event in the s-alert package you can use: https://github.com/juliancwirko/meteor-s-alert#callback-onclose

    Just pass a function that has your Router.go into that property of the alert.