Thank you, @yvan, for answer. Links you added are good.
But there are better documentation in source code comments. If you want to understand how it works you should look through files includes/ajax.inc
and misc/ajax.js
.
My problem was solved like this:
(function($) {
Drupal.behaviors.MyModule = {
attach: function (context, settings) {
// Overwrite beforeSubmit
Drupal.ajax['some_element'].options.beforeSubmit = function (form_values, element, options) {
// ... Some staff added to form_values
// return false; // to prevent AJAX call if needed.
}
//Or you can overwrite beforeSubmit
Drupal.ajax['some_element'].options.beforeSerialize = function (element, options) {
// ... Some staff added to options.data
// Also call parent function
Drupal.ajax.prototype.beforeSerialize(element, options);
}
//...
These functions are calling in jQuery Form Plugin.