Remove javascript events before adding them in initializer

If the initializer function is called multiple times, the events will be
readded and the ajax request may be done multiple times.
By removing the events before, it will prevent this problem.