Error/Success message from form submitted by button with code

Hello folks!

I need to return a message, and other codes, after a button submit a form with Wix Data Update Code.

Example: if success, show a message and turn a button visible.
If error, show a message to try again and refresh de page.

How to put this condition after a submit data by the button.

Thanks.