DOL-125 : onloadend is not invoked in PhoneGap/Cordova environment, replaced with onreadystatechange which works in all environment.