public class ServiceController : Controller { public JsonResult GetServiceInfo() { var services = ServiceController.GetServices(); var serviceInfo = services.Select(s => new { Name = s.ServiceName, Status = s.Status.ToString(), Path = s.DisplayName });
return Json(serviceInfo, JsonRequestBehavior.AllowGet);
}
}
$(document).ready(function() { setInterval(function() { $.ajax({ url: '/Service/GetServiceInfo', type: 'GET', dataType: 'json', success: function(data) { var html = '';
$.each(data, function(index, item) {
html += '' + item.Name + ' ' + item.Status + ' ' + item.Path + ' ';
});
$('#serviceInfo tbody').html(html);
}
});
}, 5000);
});
服务名称 | 状态 | 路径 |
---|