Change input text after successful api response

What is the best way of handling form changes based on api response? I am having a newsletter form with an input for email and a button. I want to change the text of the input field and disable the input, when they successful subscribed to my newsletter. How can I achieve it?
Thanks for your help!

Community Page
Last updated: