use onload/onerror events on xhr2