pass custom header on request

pass custom header on request

we need to be able to pass custom request headers and set a proxy when posting and changing the window location in an ajax post.
Example:
current url: www.domain.com/home
new window: www.newdomain.com
 
code (psuedo code)
$.ajax({
      url: 'http://www.newdomain.com',
      proxy: 'www.proxy.com:8080',
      enctype: 'multipart/form-data',
      data: '',
      cache: false,
      complete: function (){
            window.location('http://www.newdomain.com'),
      },
      beforeSend: addHeaders
})
 
function addHeaders{'user: someuser, session: sessionid}
 
In red above is a guess about the proxy, not sure how to set that at all. Also not sure I am setting the custom headers correctly. We are trying to tell the new domain that we are already authenticated and pass a current session id to it when changing the window location.
There may be a better way to do this instead of using .ajax-post, so I am open to a different idea. We can do something similar in C# code, correctly authenticate and get the appropriate response back, but I loose the session info when trying to open a new window location.
 
Thanks,