Is there a difference in browser behavior between:
var xhr = new XMLHttpRequest();
xhr.open('GET',url);
xhr.onload = function(){/*various things*/};
xhr.onerror = function(){/*various things*/};
xhr.send();
and
var xhr = new XMLHttpRequest();
xhr.onload = function(){/*various things*/};
xhr.onerror = function(){/*various things*/};
xhr.open('GET',url);
xhr.send();
The reason I ask: I have an uploading process that performs ~500 xhr.sends() (over many GBs of uploads), and I'm seeing that sometimes just one of the .sends() silently fails - no evidence of the request in the servers logs, and no errors shown on the client side. As an experiment I changed my code from the 1st pattern above, to the 2nd pattern, and it seems to be 'fixed', but n=1 does not a proof make, so I'm trying to figure whether there is a best practice, or rationale for doing #2 instead of #1.
It's in Chrome 25.0.1364.172m on Win7. Perhaps it's a Chrome bug, but before I file that I want to check I'm not missing something obvious.
Thanks!