gpt4 book ai didi

javascript - 来自 soap 的动态 justgage 值

转载 作者:行者123 更新时间:2023-11-30 00:03:01 25 4
gpt4 key购买 nike

我想显示从 $("#spanrWS_Measured").text(data[0]); 返回的值作为我的 justgage 值(当前为 123)。任何帮助都会很棒。完整代码如下。

 <script src="scripts/raphael-2.1.4.min.js"></script>
<script src="scripts/justgage.js"></script>
<script type = "text/javascript">

$(document).ready(function(){
setInterval(ajaxcall, 5000); // Call every 5 seconds
}); function ajaxcall(){
$.ajax({
url: 'soap.php',
success: function(data) {
data = data.replace('[','');
data = data.replace(']','');
data = data.split('|');

// Status
$("#spanrWS_Measured").text(data[0]);

}
}); }
document.addEventListener("DOMContentLoaded", function(event) {
var g1;

<!--Start G1->
var g1 = new JustGage({
id: "g1",
value: 123,
min: 0,
max: 100,
pointer: true,
pointerOptions: {
color: '#222D4B',
},
decimals: 1,
startAnimationTime: 500,
startAnimationType: ">",
refreshAnimationTime: 1000,
refreshAnimationType: "bounce",
title: "",
label: "mps",
titleFontColor: "black",
valueFontColor: "black",
labelFontColor: "black",
relativeGaugeSize: true,
customSectors: [{
color : "#00ff00",
lo : 0,
hi : 60
},{
color : "#ff0000",
lo : 61,
hi : 120
}],

});
<!--End G1-->
});
</script>

最佳答案

我最后用的是这个

   function ajaxcall(){
$.ajax({
url: 'soap.php',
success: function(data) {
data = data.replace('[','');
data = data.split('|');

// Dials
g1.refresh(data[0]);
g2.refresh(data[1]);
g3.refresh(data[2]);

关于javascript - 来自 soap 的动态 justgage 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39617837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com