Custom code on button click for redirection to a custom page

custom code on button click for redirection to a custom page.

we want to implement a functionality , where on click a form submission button , want to call custom api and redirect the user external web app. so we want to understand the below following things .

  1. on button click , how to call custom JavaScript methods .

is there any support for other languages ?