[SOLVED] Load new page on button click?

I have a button that executes a function that checks to see if a input box is empty, and if it is not empty, will load a new page. I need to take the following link (which loads the page correctly) and have it so it will load the page from the function executed on button press:

/error/ is as follows in routes.js:

path: ‘/error/’,
url: ‘./pages/error.html’,