Added onloadend() callback for XHRs