Creating advanced button

Hello everybody,
I have a web service that listen to HTTP GET request.
This web service response with parameter to the client.
I’m trying to achieve a button that sends the request on click, get back the response, test the parameter value for x and then animate item on the screen.
What is the simplest method to achieve this?
Thanks in advanced