2
我想顯示從$("#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>
用這個當你在計參考var.like g1.refresh數據呼叫刷新功能(10); – Murali
謝謝。我最後用這個 g2.refresh(data [1]); – BjH
不客氣。 – Murali