title: How to redirect with custom header using jQuery?
body: <p>I make this kind of request for login, sending username and password and receiving a token:</p>
  
  <pre><code>$(document).ready(function() {
    $("#loginForm").submit(function() {
      $.ajax({
        type: "POST",
        url: "./login",
        data: $(this).serialize(),
        success: function(e) {
            window.location.href = e['redirect_url']
            localStorage.setItem("token", e['token'])
            alert('redirected')
            return false
        }
      })
  
    })
  })
  </code></pre>
  
  <p>and I want the redirect to use <code>{'Authorization': 'Token '+localStorage.getItem('token')}</code> in headers, because the redirect URL requires authorization. How do I alter the header in redirect? Or is there another way around?</p>