First of all, the fact that the page was generated by a JSP is irrelevant. Once the response gets to the browser, it's just an HTML page like any other.
You'll also need to explain what you are trying to do with more clarity. It's not clear what you are trying to do. Are you asking how to execute two functions upon receiving the response of an Ajax request? Some thing else? How do the text fields that you mentioned factor into this?