how to redirect from function inside a common function in javascript code example Example: jquery redirect to url $(location).attr('href', 'https://google.com');