This is a detail but this is not the recommended way to build an URL. You should use the JavaScript reverse router.