我想显示从$("#spanrWS_Measured").text(data[0]);
返回的值作为我的测量值(当前为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 的动态标量值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39617837/