MDL-45867: change to asynchonous ajax

Hello Geoff,

I did a cherry-pick of my bug fix of the equation editor merged it into your chemistry error. This patch prevents the locking of the keyboad when the display updates which make typing difficult, and improves the placement of the insertions.