How to log clicks on certain elements in the system

Task: to make a record in the database of clicks on certain elements in the system. 

1. Button layout: 

<a href="#" class="as-logger" data-text="11" data-header="2222" data-itemid="3333">Ссылка</a>

2. In the global JS, we create a click handler for the button (we use the mechanism Request JS): 

 $(document).delegate('.as-logger', 'click', function (e) {
            var el = $(this);
            if (el.attr('data-prevent') === "1") e.preventDefault();

            as.sys.request("web", "logger", {
                data: {
					text: cont.attr('data-text') || "",
					header: cont.attr('data-header') || "",
					itemID: cont.attr('data-itemID') || ""
                onSuccess: function (data) {
                    // if (data.result && && { }

3.In the SQL procedure for the Request JS mechanism, we process data by click: 

create PROCEDURE [dbo].[request_web_logger]
	@parameters DictionaryParameter READONLY,
	@username nvarchar(32)
	declare @text nvarchar(256) = '',  @header nvarchar(256) = '',  @itemID nvarchar(256) = ''
	select @text = Value from @parameters where [Key]='text'
	select @header = Value from @parameters where [Key]='header'
	select @itemID = Value from @parameters where lower([Key])='itemid'

	exec as_trace_warn ('logger', @header, try_cast(@itemID as int), @text, @username)

     -- SELECT 1 Msg, Result
	select 'OK' Msg, 1 Result

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

    -- SELECT 3 External actions


This way, the data will be saved in the table as_trace. 

Falcon Space is a functional web development platform on a narrow stack MS SQL/Bootstrap. Falcon Space Gettting started

Falcon Space Platform

This is a reduction in the cost of ownership

at the expense of fewer people to support

This is a quick change

while using the program

This is a modern interface

full adaptation for mobile devices