nginx_switch.js
1.88 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 () {
$("#validateTokenRltInfo").hide();
});
function initSwitch(cloudName, target) {
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
title: "你确定切换吗",
backdrop: "static",
content: "你确定要将" + cloudName + "上的流量切向" + target + "吗?",
buttons: [{
text: "否",
className: "btn-danger",
onclick: function () {
$(dialog).dialog("hide");
}
}, {
text: "是",
className: "btn-success",
onclick: function () {
var param = {
cloudName: cloudName,
target: target
}
$.ajax({
type: 'post',
url: 'switchNginxConf',
data: param,
dataType: 'text',
success: function (resp) {
$(dialog).dialog("hide");
var data = JSON.parse(resp);
var dialog2 = $("<div>").appendTo($("body"));
dialog2.dialog({
title: "切换结果",
backdrop: "static",
content: data.data,
buttons: [{
text: "确定",
className: "btn-danger",
onclick: function () {
window.location.href = getUrlBasePath() + "/nginxswitch/toNginxSwitch";
}
}]
});
},
error: function (data) {
layer.msg("Token异常", {icon: 2});
}
});
}
}]
});
}