fix: use xhr events instead of onreadystatechange