Lost functionality after HTML reloaded with AJAX call
Hi! Couldn't find an answer on this in here or stackoverflow, but I guess is something common.
I'm loading some content dynamically using jQuery $.get function.
If you have for example $('.element').click(some function); and you reload the element with AJAX, that directive get lost. You can easily make it work by attaching the function to the body instead: $('body').on('click', '.element', some function);
But I don't know how to replicate that with Metronic managed functions in scripts.bundle.js. Specifically I'm reloading some HTML with data-kt-menu-trigger="click" inside, and that functionality get lost.
Any help would be much appreciated!
Replies (3)
Hi,
Please call KTComponents.init() method to initialize newly populated components via Ajax on Ajax complete event.
For more info please check this guide.
Regards.
Hi
,
Glad to help you out. All the best with your project!
Regards.