How to link my JS code to my Ethereum Blockchain Smart Contract

I have a smart contract to issue a certificate to a user on the blockchain, when a submit button is pressed on the webpage. How do I link the two, so that upon pressing submit on the page, the certificate is issued to that user’s address (that means the smart contract is implemented.)