title: Jquery ajax complete not getting custom reponse header?
body: <p>I am trying to pass a custom response header to notify my javascript the user has timed out. It works good expect when it comes to using it with jquery u.i dialogs.</p>
  
  <p>I have this</p>
  
  <pre><code>$.ajaxSetup
  ({
      complete: function (event, xhr, options)
      {
  
          if (event.getResponseHeader('X-LOGON') === 'LogOn')
          {
  
              window.location.href = "redirect to signin";
          }
      }
  
  });
  </code></pre>
  
  <p>So this should run after every jquery ajax request and it does.</p>
  
  <p>Now I have something like this for my dialog </p>
  
  <pre><code>  $.manageAjax.add('NonCachedAjaxRequests',
      {
          type: "GET",
          url: 'ajaxRequestPath',
          success: function (result)
          {
              $('#Dialog').html(result).dialog(
              {
                  width: 580,
                  height: 410,
                  resizable: false,
                  modal: true,
                  buttons:
                  {
                      Cancel: function ()
                      {
                          $(this).dialog('close');
                      },
                      'Create': function ()
                      {
                          // create;   
                      }
                  },
                  close: function ()
                  {
                      //destroy
                  }
              });
  
  
          }
      });
  
      return false;
  
  });
  </code></pre>
  
  <p>I am using something called ajax manager <a href="http://www.protofunc.com/scripts/jquery/ajaxManager/" rel="nofollow noreferrer">http://www.protofunc.com/scripts/jquery/ajaxManager/</a> this just helps with stopping double clicks and stuff like that and uses all the same methods that $.ajax would use.</p>
  
  <p>So now when I look at the request coming back to populate the above dialog box I see this in firebug</p>
  
  <pre><code>Response Headersview source
  Server  ASP.NET Development Server/10.0.0.0
  Date    Fri, 02 Jul 2010 22:12:36 GMT
  X-AspNet-Version    4.0.30319
  X-AspNetMvc-Version 2.0
  X-LOGON LogOn
  Cache-Control   private
  Content-Type    text/html; charset=utf-8
  Content-Length  6468
  Connection  Close
  </code></pre>
  
  <p>Notice how it says "X-LOGON" but when it comes to my ajaxSetup and gets to </p>
  
  <pre><code>if (event.getResponseHeader('X-LOGON') === 'LogOn')
  </code></pre>
  
  <p>it always says it is null but as you can clearly see firebug is saying otherwise. I don't understand whats is going on.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Ok it seems to be a problem with ajax manager. I really want to keep using it or something comparable as it really helps out with stopping duplicate requests. </p>
  
  <p>What I found out is that it does not like global ajaxSetups I don't know why it just does not like them. I started to try to use status codes instead so I been playing around with "403" and found this.</p>
  
  <p>if an ajax request 403's out and your using ajaxSetup with complete and ajaxmanager it will still try to go into the success message one.</p>
  
  <p>If you put an ajax complete before the success one(it does not work if complete is after success) and it comes back with 403 then ajax manager has no problem acting on it and hitting the complete.</p>
  
  <p>So I am not sure what to do. I want to use ajaxmanager or something like it and I want to use ajaxSetup.</p>
  
  <p>So I don't know if I can have both at this moment though.</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>When I use status codes and ajaxSetup with ajax manager I get this error</p>
  
  <blockquote>
    <p>error: status: 403 | URL:
    /MyURL
    <a href="http://localhost:3086/Plugins/AjaxManager/Source/jquery.ajaxmanager.js" rel="nofollow noreferrer">http://localhost:3086/Plugins/AjaxManager/Source/jquery.ajaxmanager.js</a>
    Line 44</p>
  </blockquote>
  
  <pre><code> error: function(ahr, status){
  36 var opts = this;
  37 if(status &amp;&amp; status.indexOf('error') != -1){
  38 setTimeout(function(){
  39 var errStr = status +': ';
  40 if(ahr.status){
  41 errStr += 'status: '+ ahr.status +' | ';
  42 }
  43 errStr += 'URL: '+ opts.url;
  44 throw new Error(errStr);
  45 }, 1);
  46 }
  47 }, 
  </code></pre>
  
  <p>so I don't know if this is another reason why I am getting an error.</p>
  
  <p>Edit 4</p>
  
  <p>Seems like I been using a version that apparently is not compatable for version 1.4(not sure why it worked)</p>
  
  <p>Anyways I am using 3.0 now it still does not work but it has some new options that I would like to try but have no clue how to use them.</p>
  
  <p><a href="http://www.protofunc.com/scripts/jquery/ajaxManager3/" rel="nofollow noreferrer">http://www.protofunc.com/scripts/jquery/ajaxManager3/</a></p>
  
  <p>If you look at the events/callbacks it's got some global complete so maybe that might be what I need. Have no clue how to run it though.</p>