-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload.js
67 lines (62 loc) · 1.84 KB
/
load.js
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
58
59
60
61
62
63
64
65
66
67
function cargaSeccion(urld, menuId) {
var d = new Date();
$.ajax({
url: urld + '?idp' + d.getTime()
}).done(function(data) {
$("#contenidoTab").html(data);
$(".menuTabs").removeClass("active");
// $('li').removeClass("menuActivo");
$("#secc_" + menuId).addClass("active");
}).fail(function() {}).always(function() {});
}
function loadCss(url, callback) {
var d = new Date();
var script = document.createElement('link');
if (script.readyState) { // IE
script.onreadystatechange = function() {
if (script.readyState === 'loaded' || script.readyState === 'complete') {
script.onreadystatechange = null;
callback();
}
var d = new Date();
};
} else { // Others
script.onload = function() {
callback();
};
}
script.media_type = "text/css";
script.rel = "stylesheet";
script.href = url + "?fecha=" + d.getTime();
document.getElementsByTagName('head')[0].appendChild(script);
}
function loadScript(url, callback) {
var d = new Date();
var script = document.createElement('script');
if (script.readyState) { // IE
script.onreadystatechange = function() {
if (script.readyState === 'loaded' || script.readyState === 'complete') {
script.onreadystatechange = null;
callback();
}
var d = new Date();
};
} else { // Others
script.onload = function() {
callback();
};
}
script.src = url + "?fecha=" + d.getTime();
document.getElementsByTagName('head')[0].appendChild(script);
}
function cargaUrl(urld, menuId) {
var d = new Date();
$.ajax({
url: urld + '?idp' + d.getTime()
}).done(function(data) {
$("#contenido").html(data);
$(".dropdown").removeClass("menuActivo");
$('li').removeClass("menuActivo");
$("#menu_" + menuId).addClass("menuActivo");
}).fail(function() {}).always(function() {});
}