For operation of the module often requires a separate JavaScript-script. There are several options to connect JS-files. Consider the example of them.

  • modules/shop/admin/js/shop.admin.js connect to products edit (on all pages).
  • modules/shop/admin/js/shop.admin.category.js connect to categories edit

You can also add edit, then file connect only to edit or add an item. For example, modules/bs/admin/js/bs.admin.edit.js only connect to form editing / adding banner.

Also automatically connect to the module-connections:

  • modules/images/admin/js/images.admin.inc.js – action edit when editing the attached images in the item;
  • modules/images/admin/js/images.admin.inc.config.js – action edit when editing images settings in the module.

Once the files are automatically loaded for the functions of the file adm/includes/edit_functions.php:

  • adm/js/edit/admin.edit.field.js – for the treatment of the "field";
  • adm/js/edit/admin.edit.config.field.js – for the treatment of "fields" in the module settings.

Well, you can also manually set:

$this->diafan->_admin->js_view[] = 'modules/images/admin/js/images.admin.inc.js';

The JS-code also need to take its own characteristics.

To correct the request, checked identification hash, Ajax-requests should be sent through the function diafan_ajax.init():

data: Transmitted_data_in_JSON_format,
url: Address_to_which_data_is_transmitted,
success: function(response) {
// response processing

All data are not binding. If returned response.redirect, the redirection takes place irrespective of what is defined success.