Defer callback registering until after the DOM has loaded.

This is required to enable the callback for AJAX functions in plugins.
Merge pull request #176 from opf/feature/fix-csrf-for-ajax-in-plugins

Defer callback registering until after the DOM has loaded.