checkResponse function

Check the response from remote server