JS. Implementation of custom JS improvements in the system

If you need to implement functionality that does not fit into the standard one, you need to create your own components based on JS in the page. 

Custom JS Request is used for requests to the server.

Example of a request to the server: 

1. Implementing a request in a JS file from a page (as.sys.request(module, action, parameters)): 

 

as.sys.request("sms", "confirm", {
            data: { code: cont.attr('data-code') },
            onSuccess: function (data) {
                if (data.result && data.data && data.data.length) {
                }
             }
});

2. Creating a stored procedure for processing actions

create PROCEDURE [dbo].[request_client_confirm]
	@parameters DictionaryParameter READONLY,
	@username nvarchar(32)
AS
BEGIN
        -- SELECT 1 Msg, Result
	select 'Все ок' Msg, 1 Result

        -- SELECT 2 Basic data in the form of an arbitrary table
        select top 10 * from as_trace

        -- SELECT 3 External action

END

The SQL procedure outputs the following SELECT:

  1. SELECT 1 - Result, Msg
  2. SELECT 2 - any data that comes to JS in the data object
  3. SELECT 3-external actions (sending Email, SMS, notifications, etc.). See External actions.

This way you can implement any functionality within the page.