Skip to main content
Skip table of contents

Shared functions

Before using the functions on this page, you may find it useful to review the following information:

The list of all functions is here.

Description of this function

It is not necessary to call these functions, but they may be useful for debugging.

A lot of the function code samples use the following functions. resultjson is a <pre> tag that shows the formatted JSON response. It is not necessary to call these functions but they may be useful for debugging.

Note that cookies are NOT used for session management thus avoiding various cookie related attacks such as XSS or XSRF. Instead the login request returns a UUID which is then used for all further requests. 

Also note the server session lifetime is 20 mins. 

OnGetJson() function

function OnGetJson(url, data) {
    $("#resulttable, #resultchart").hide();
    $.support.cors = true;
        url: baseUrl + url + '?id=' + _uuid,
        type: 'POST',
        contentType: 'application/json',
        data: JSON.stringify(data),
        dataType: 'json',
        success: SuccessHandler,
        error: ErrorHandler

function SuccessHandler(result) {
    $("#resultjson").html(JSON.stringify(result, null, 2).replaceAll("\\\\", "\\"));

function ErrorHandler(xhr, exception) {
    var msg = '';
    if (xhr.status === 0) {
        msg = 'Not connect.\n Verify Network.';
    } else if (xhr.status == 401) {
        msg = JSON.parse(xhr.responseText);
    } else if (xhr.status == 404) {
        msg = 'Requested page not found. [404]';
    } else if (xhr.status == 500) {
        msg = 'Internal Server Error [500].';
    } else if (exception === 'parsererror') {
        msg = 'Requested JSON parse failed.';
    } else if (exception === 'timeout') {
        msg = 'Time out error.';
    } else if (exception === 'abort') {
        msg = 'Ajax request aborted.';
    } else {
        msg = 'Uncaught Error.\n' + xhr.responseText;

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.