title: Interpreting long 'Start' network timing on ajax call in IE11 dev tools
body: <p>At seemingly random times, the app I work on takes several seconds to send an ajax call, and I'm having difficulty interpreting the data from the network tab in the debugger.</p>
  
  <p><a href="https://i.stack.imgur.com/gV8xw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gV8xw.jpg" alt="enter image description here"></a></p>
  
  <p>Basically the 'Start' takes somewhere between 4 and 12 seconds. If I look at the MSDN docs and the browser itsself it states: 'The time from when the request was initially created to when the request is sent.'</p>
  
  <p>What does it mean? </p>
  
  <ul>
  <li><p>Is it the time between creating the xmlhttp variable and calling the send() method of the object? This is how I interpret "from created to sent". Which would imply that the issue is somewhere in the ajax request code.</p></li>
  <li><p>Or is it the time between the click on the GUI, which would call a bunch of functions, of which one would trigger the ajax call? Which would mean there's a big delay between the event handler and the calling of the ajax function.</p></li>
  <li><p>Am I running into browser request queue limits due to making alot of requests? If this could be a problem, any tips on how to check this?</p></li>
  <li><p>Anything else?</p></li>
  </ul>
  
  <p>I'll include the current code making the ajax calls in case option 1 is correct and something is wrong with the ajax function.</p>
  
  <pre><code>function get( path ) {
      var xmlhttp = null,
          domainRequest = false,
          handler,
          queryName,
          result = {};
      if (path.charAt(0) === '/') path = this.host + path;
      // Implicit resource name, get from path.
      if (arguments.length === 2) {
          queryName = path.substring(7).split('/')[1];
          handler = arguments[1];
      }
      // Explicit resource name or alias.
      else if (arguments.length === 3) {
          queryName = arguments[1];
          handler = arguments[2];
      }
      result[queryName] = {
          "value" : null,
          "info" : {
              "filtered" : false,
              "query" : queryName,
              "server" : false,
              "status" : "ERROR",
              "message" : ""                      
          }
      };
      xmlhttp = new XMLHttpRequest();
      xmlhttp.onload = function() {
          var type = (domainRequest) ? 'text/plain' : xmlhttp.getResponseHeader('Content-Type'),
              response = (type === 'text/xml') ? xmlhttp.responseXML : xmlhttp.responseText;
          if (response) result[queryName] = response;
          else result[queryName].info.message = "Malformed data.";
          handler(result);
      };
      xmlhttp.onerror = function() {
          // Failure on the network level.
          if (window.navigator.onLine) result[queryName].info.message = "The requested resource could not be found or the service is down.";
          else result[queryName].info.message = "No network.";
          handler(result);
      };
      xmlhttp.open('GET', path);
      // CORS and IE10-IE11 withCredentials fix: the object state has to be OPEN to set the credentials flag in IE10-IE11
      xmlhttp.withCredentials = true;          
      // IE7-9 domain request premature abort fix.
      // http://cypressnorth.com/programming/internet-explorer-aborting-ajax-requests-fixed/
      xmlhttp.ontimeout = function() {
          result[queryName].info.message = "Network timeout.";
          handler(result);
      };
      xmlhttp.onabort = function() {
          result[queryName].info.message = "Request aborted.";
          handler(result);
      };
      xmlhttp.onprogress = function() {};
      xmlhttp.send();
  }
  </code></pre>