
[英]how to get exact two digits after decimal point in jquery or javascript
[英]How to force jquery get to stop ignoring decimal point values
即时通讯使用Justgauge创建量规。 我正在使用jquery get方法和数据库中的数据,但它只给我整数,而我希望浮点值。
//PHP code to get the value from database
<?php
error_reporting(0);
$connect = mysqli_connect("", "", "", "");
$query = "SELECT wilgotnosc FROM Pomiary ORDER BY id DESC LIMIT 1";
$result = mysqli_query($connect, $query);
$array = mysqli_fetch_array($result);
echo $array[0]; //of course here i got the floating point value
?>
下面的jQuery
window.onload = function(){
var g = new JustGage({
id: "gauge",
value: 0,
min: 0,
max: 100,
label: "wilgotność %"
});
setInterval(function() {
$.get('api.php', function (newValue) { g.refresh(newValue); });
$ .get仅返回整数值,如何获得浮点值?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.