嘿大家都在寻找帮助在jquery中为变量添加.toFixed。
< script type = "text/javascript" > $(document).ready(function() {
var a = $("#address").text();
$.get("http://99.236.215.227:7379/hget/Pool_Stats:CurrentShift:WorkerBTC/" + a + ".txt", function(b) {
$(".payout").text(b)
});
$.get("http://99.236.215.227:7379/hget/Pool_Stats:CurrentShift:WorkerNEOSCoin/" + a + ".txt", function(b) {
$(".payout2").text(b)
});
$.get("http://99.236.215.227:7379/hget/Pool_Stats:CurrentShift:WorkerFUELCoin/" + a + ".txt", function(b) {
$(".payout3").text(b)
})
});
$(function() {
var a = $("#address").text();
$.get("http://99.236.215.227:7379/ZSCORE/Pool_Stats:Balances/" + a, function(b) {
$(".owed").append(b.ZSCORE)
})
}); < /script>
答案 0 :(得分:2)
因此将其转换为数字并应用于固定(8)
parseFloat(b).toFixed(8)
因为你不知道text()是如何工作的,所以该行应该是
$(".payout2").text(parseFloat(b).toFixed(8))