title: Microsoft Edge and ajax timing
body: <p>I have code with an ajax request that has been running fine for over two years but fails intermittently in Microsoft Edge. </p>
  
  <pre><code>set_page : function()
  {
      $.ajax(
      {
          type: 'POST',
          url: '/ajax/set_page',
          dataType: 'json',
          data: {'book_id' : this.book_id, 'page' : this.page},
      });
  },
  </code></pre>
  
  <p>ajax/set_page is a php function that updates the column 'page' in the book table. </p>
  
  <p>When I debug the code in Chrome, the database is updated as soon as I step over the $.ajax call. In Edge, the database is not updated until the program thread in javascript is finished. </p>
  
  <pre><code>set_page {
  -----------&gt; Chrome db -&gt; page = 11, Edge db -&gt; page = 11
     $.ajax({...POST}); 
  -----------&gt; Chrome db -&gt; page = 12, Edge db -&gt; page = 11
  };
  };
  };
  ----------&gt; Edge db -&gt; page = 12, ajax success!
  </code></pre>
  
  <p>Usually that is not a problem but occasionally the thread has a lot of extra processing and when the ajax/set_page php function is finally called, the $_POST values are null.</p>
  
  <p>Has anybody else seen this sort of behavior in Edge? Is there any way to kick off the ajax request so it calls my php function right away? </p>
  
  <p>Maybe my question should be: Why are my $_POST variables sometimes null in my ajax call in Edge? Is there some way to debug them between the $.ajax call and my php function?
  ....................</p>
  
  <p>After more debugging, a page reload that happens in IE11 (to fix a flash/IE11 bug) is causing the problem.  </p>
  
  <pre><code>set_page {
  -----------&gt; Chrome db -&gt; page = 11, Edge db -&gt; page = 11
     $.ajax({...POST}); 
  -----------&gt; Chrome db -&gt; page = 12, Edge db -&gt; page = 11
  };
  };
  if last_page
     do stuff
     if IE11
       location.reload()
  };
  ----------&gt; 
  not last page: Edge db -&gt; page = 12, ajax success!
  last page: Edge db -&gt; page = null, book_id = null
  </code></pre>
  
  <p>So I have two issues: </p>
  
  <ol>
  <li><p>it looks like when the page is reloaded, the POST parameters are cleaned up but the ajax request is still executed. </p></li>
  <li><p>the Edge browser is being identified as IE11.</p></li>
  </ol>
  
  <p>It looks like the IE11/flash bug was fixed in Edge so I should be able to remove the reload but I need to do some more testing to make sure. </p>