-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScript.js
More file actions
57 lines (55 loc) · 1.78 KB
/
Copy pathScript.js
File metadata and controls
57 lines (55 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function cAJAX() {
this.Url = '';
this.FunctionName = 'fAJAX()';
this.Execute = function () {
var functionName = this.FunctionName;
var msg = '';
url = this.Url;
var oXMLhttp = GetXmlHttpObject();
if (oXMLhttp == null) {
msg = 'Recurso AJAX não suportado ou está bloqueado, revise as configrações, atualize o navegador e ODBC.';
if (oMsg) { oMsg.innerText = msg } else { window.status = msg };
} else {
msg = 'Consulta AJAX sendo realizada, aguarde...';
if (oMsg) { oMsg.innerText = msg } else { window.status = msg };
oXMLhttp.onreadystatechange = function () {
if (oXMLhttp.readyState == 4 || oXMLhttp.readyState == 'complete') {
msg = 'Consulta AJAX finalizada';
if (oMsg) { oMsg.innerText = msg } else { window.status = msg };
if (oXMLhttp.status == 200) {
functionName = functionName.replace('()', '(oXMLhttp.responseText)');
msg = 'Consulta AJAX finalizada.';
if (oMsg) { oMsg.innerText = msg } else { window.status = msg };
eval(functionName); // executa funcao
} else {
msg = 'Consulta AJAX sendo realizada, aguarde...';
if (oMsg) { oMsg.innerText = msg } else { window.status = msg };
};
if(oXMLhttp.status == 404) {
msg = 'Consulta AJAX não retornou dados, possivel página não encontrada.';
if (oMsg) { oMsg.innerText = msg } else { window.status = msg };
return;
};
};
};
oXMLhttp.open('GET', url, true);
oXMLhttp.send();
};
};
};
function GetXmlHttpObject()
{
try { return new ActiveXObject('Msxml2.XMLHTTP') }
catch(e) {
try { return new ActiveXObject('Microsoft.XMLHTTP') }
catch(e) {
try { return new XMLHttpRequest() }
catch(e) { return null }
};
};
};
function fGo(link) {
var aa = document.getElementById('aMenu');
aa.href = link;
aa.click();
}