How to update by clicking link

We have a requirement that when clicking a link, will start file download, at the meantime, we need to do some data update.

Can anyone advice how to achieve this?

  Discussion posts and replies are publicly visible