Without ajax, if we load http://example.com/1
and if it redirects to http://example.com/2
then the browser gets appropriate headers and the Browser URL
This might not be exactly what you're looking for, but maybe it will help you get a similar effect.
If you are in control of what the page http://api.example.com
does, you could change the way it reacts when it gets a call via AJAX.
You could include a variable in your AJAX call, marking it as such a call, and if this variable is present, not redirect to an other page, but include the URL it would redirect to, in the answer.
The data returned in the AJAx call could be a hash, in which one key represents the redirect url.
data = {status => 1, redirect => 'http://ap2.example.com', …}
(Sorry if that is not a valid PHP hash)