PageSourceSearch

https://kestava.fi/MyJs/tilt.ajaxService.js?v=80

js kestava.fi collected 2026-10-02 01:54:25 UTC 3,628 bytes, 121 lines download raw bytes

1
2
3$.ajaxSetup({
4    cache: false
5});
6
7var globalShowAjaxLoading = true;
8
9$(document).ajaxStart(function () {
10    if (globalShowAjaxLoading == true)
11        NProgress.start(); 
12});
13
14$(document).ajaxStop(function () {
15    NProgress.done();
16});
17
18var dataService = new function () {
19
20    
21    //declare a function that will call a webservice
22    //via ajax that will accept the address to the webservice
23    //the parameter values, a success call back function
24    //and an optional error callback function
25    var getData = function (serviceAddress, parameters, successCallBack, errorCallBack, isAsync, methodType, showAjaxLoading) {
26        var async = true;
27        if (isAsync != null) {
28            async = isAsync;
29        }
30
31        if (showAjaxLoading != null) {
32            globalShowAjaxLoading = showAjaxLoading;
33        }
34        else
35            globalShowAjaxLoading = true;
36
37        var type = "POST";
38        if (methodType != null) {
39            type = methodType;
40        }
41        $.ajax({
42            url: serviceAddress,
43            contentType: "application/json; charset=utf-8",
44            type: type,
45            async: async,
46            dataType: "json",
47            data: parameters,
48            success: function (result) {
49                //reset this
50                globalShowAjaxLoading = true;
51                //if a success callback was passed in then
52                //execute the function
53                if (successCallBack != null) {
54                    //we can just return the actual result of result.d
55                    //to avoide having to write the var data = result.d every
56                    //time we make a call to a WCF or asmx webservice
57                    successCallBack(result.d);
58                }
59                
60            },
61            error: function (xhr, status, error) {
62                //reset this
63                globalShowAjaxLoading = true;
64                //if an error callback function was passed in then
65                //use it other wise just use the default
66                //error handling function as part of this dataService object
67                if (errorCallBack != null) {
68                    //execute the call back
69                    errorCallBack(xhr, status, error);
70                }
71                else {
72                    //execute the default function
73                    onError(xhr, status, error);
74                }
75            }
76        });
77    }
78
79    //declare a default error handler
80    var onError = function (xhr, status, error) {
81        var r = jQuery.parseJSON(xhr.responseText);
82        if (r != null)
83        {
84            if (r.Message != null && r.Message != '')
85            {
86                if (checkForSpecificMessage(r.Message) == true)
87                    notificationService.ShowSpecificError(r.Message);
88            }
89                
90        }   
91        else
92        {
93            if (error != null && error != '')
94            {
95                if (checkForSpecificMessage(error) == true)
96                     notificationService.ShowSpecificError(error);
97            }
98                
99        }
100            
101        return false;
102    }
103
104    var checkForSpecificMessage = function (message) {
105        if (message.toLowerCase() == 'tenant is not in context') {
106            location.reload();
107            return false;
108        }
109        else
110        { return true;}
111
112    }
113
114
115    //expose the getData function
116    return {
117        getData: getData,
118        onError: onError
119    };
120
121}();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.