In situ x-ray absorption study of hydride electrodes