vojtech-dobes / nette.ajax.js

Flexible AJAX for Nette Framework. Supports snippets, redirects etc.
https://componette.org/vojtech-dobes/nette.ajax.js/
MIT License
149 stars 85 forks source link

Binding ajax handlers to body via $('body').on() #139

Closed ParallelUniv3rse closed 7 years ago

ParallelUniv3rse commented 7 years ago

It would be very helpful to rewrite the plugin or at least have an option to bind handlers via $('body').on(), so any ajax forms, etc. inside snippets stay ajaxified.

vojtech-dobes commented 7 years ago

You can configure the plugin to do it:

$.nette.init((requestHandler) => {
    if (!this.initialized) {
        $('body').on('click.nette', 'a.ajax', requestHandler);
        $('body').on('submit.nette', 'form.ajax', requestHandler);
        this.initialized = true;
    }
});