Fix HTML edition from JS.

We were inserting the new div inside the old div, but we want to replace
the old with the new instead.
Clean error reporting using ajax linking.