Ajax request from FormWidget

I would like to make an ajax call from a FormWidget, how can I achieve that?

When I e.g.:

oc.ajax('onSomething', {
    success: function(data) {
        console.log(data);
    }
})

…the post request is sent to the controller I guess, in it’s context.

Can I use the OC ajax API for that?

Actually I can do everything in the FromWidgets getSaveValue method. But since I want to update all records of my model, I decided to move this to the settings, where I can register this in the Plugin.php with registerSettings:
Introduction - October CMS - 3.x

1 Like