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
Yes, when you request http://api.example.com using Ajax, browser does not redirect. You can get all the response using jQuery like bellow
$.ajax({
url: "http://api.example.com",
success: function(data, textStatus, xhr) {
console.log(xhr.status);
},
complete: function(xhr, textStatus) {
console.log(xhr.status);
}
});