我的JustGage代码:
var g1;
setInterval(function() {
g1.refresh(getRandomInt(0, 100));
}, 2500);
var g1 = new JustGage({
id: "cpu-usage",
value: getRandomInt(0, 100),
min: 0,
max: 100,
title: "CPU",
label: "Usage",
levelColorsGradient: false
});但我想在MVC中使用jQuery.Ajax,并调用控制器,返回一些值并刷新JustGage。如何在JustGage中使用ajax调用?
$.ajax({
url: "/Home/GetData",
type: "POST",
data: { data: newValze },
dataType: "json",
success: function (data) {
alert(data);
}
});发布于 2014-06-30 03:05:43
I think it is simple. Just refresh it on Ajax success callback.
$.ajax({
url: "/Home/GetData",
type: "POST",
data: { data: newValze },
dataType: "json",
success: function (data) {
g1.refresh(getRandomInt(0, 100));
}
});
Note: Please initialize JustGage before this call. https://stackoverflow.com/questions/24479221
复制相似问题