Spinner while waiting for the API to finish

Hi all,

I am calling an API from click event handler on a submit button and the API call is taking a while like few seconds. I would like to put a spinner or some thing or disable the button while the call is going.

Is there an example that shows how to do this?

Thanks.