Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a way to get Internet Explorer not to wait until an AJAX request completes before following a link?
    primarykey
    data
    text
    <p>I have a html page that displays some basic account information and begins a long-ish running jQuery AJAX request to retrieve more detailed data. While the Ajax request is in progress it is possible for the user to click a button that has an <code>onclick</code> event to navigate to a new page using <code>location.assign</code>.</p> <p>Unfortunately if the button is clicked before the ajax request is complete nothing will happen until the ajax request completes. This is a live server issue. I want the user to be able to immediately navigate away. FF and Chrome appear to behave better but since this is a corporate intranet application they are not really an option.</p> <p>The following code is similar to the page in question:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="/js/jquery-1.3.2.min.js" type="text/javascript"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; &lt;!-- $(function () { jQuery.ajax({ type: 'GET', url: '/long-running-partial-html-ajax-endpoint', success: function (result) { $('#detail').html(result); }); }, error: function (xmlHttpRequest, textStatus, errorThrown) { $('#detail').html('Failed to load additional information:&lt;br /&gt;' + textStatus + '&lt;br /&gt;' + errorThrown); } }); }); //--&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;Account Information&lt;/h2&gt; &lt;div&gt;Some basic details here&lt;/div&gt; &lt;div&gt;&lt;button onclick="location.assign(&amp;quot;/somewhere-else&amp;quot;)" type="button"&gt;Go somewhere else now&lt;/button&gt;&lt;/div&gt; &lt;div id="detail"&gt; &lt;img src="/ajax-loading-animation.gif" alt="Loading ..." /&gt; Loading ... &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Things I've tried in the debugger (not on live) already:</p> <ul> <li>using a plain <code>anchor</code> rather than a scripted button</li> <li>using <code>xhr.abort()</code> before the <code>location.assign</code></li> <li>put <code>alert</code>s around the <code>location.assign</code> to reassure myself that the code is executing when expected</li> </ul> <p>Observation:</p> <ul> <li>IE stops animating the gif as soon as the button is clicked.</li> <li>FF/Chrome must automatically abort the ajax request as the jQuery ajax <code>error</code> event is fired</li> </ul> <p>Has anyone come across this issue before? Have you a resolution that will make the navigation more responsive?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload