How to make a remote server be invisible to a user

I have a webserver www.example.com that takes user input and calculates results on a remote server: <form action="www2.example.com/action.cgi">

Now the user is on the second server. How do I keep the user on the main server (or make www2 invisible to the user)?

One possibility is to do an Ajax query in the background, but that would mean results are transferred from www2 to www and then to the user, which adds delay and bandwidth costs.

What are some possibilities to accomplish this?

Also, if, in future, we have multiple remote servers www2, www3, etc. what would be the best way to accomplish this?