Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My bet is that the canceled <code>XMLHttpRequests</code> are a result of leaving the (iframe's) current page. </p> <p>Since you <em>do not prevent</em> the <code>click</code> event from triggering its default behavior (i.e. getting the referenced document) all the queued up event handler callbacks are being canceled once the current page unloads (keep in mind that though the AJAX calls themselves are asynchronous, the execution of the event handler callbacks is not).</p> <p><strong>EDIT</strong><br> There actually is a limit on the number of simultaneously requests to a single domain. This limit is imposed by the browser and does vary quite a bit (2 and 6 being the most common). </p> <p>See the network test from <a href="http://www.browserscope.org/?category=network" rel="nofollow">browserscope</a>.</p> <p><strong>EDIT 2</strong><br> Oh and btw. you might want to use <code>POST</code> instead of <code>GET</code> to be sure the browser won't cancel the request due to a cache hit. And if you absolutely need to make every click count, you should set the <code>async</code> flag to <code>false</code> when calling <code>new_request.open</code>. This way, all the requests will get queued up and run one after the other.</p> <p>Quick fix:</p> <pre><code>var text = "Click no:-"; var counter = 0; $("#inc").click(function() { var new_request = new XMLHttpRequest(); var new_serverURL = "http://www.google.com"; new_request.open('POST',new_serverURL,true); new_request.send(null); $("#container").html("&lt;p&gt;" + text + " " + ++counter + "&lt;/p&gt;"); // Prevent the link's default behavior return false; });​ </code></pre>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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