Implemented destroy for ajax use of API

I don't know if the commit is implemented in the correct way, but it does remove the event listeners and the containers.

Please revise and update accordingly.