Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Ajax livecount不是逗号格式_Javascript_Jquery_Ajax_Codeigniter - Fatal编程技术网

Javascript Ajax livecount不是逗号格式

Javascript Ajax livecount不是逗号格式,javascript,jquery,ajax,codeigniter,Javascript,Jquery,Ajax,Codeigniter,如何以逗号形式显示计数?目前,即使它是千种形式,它也没有使用逗号。有什么办法可以让它工作吗?先谢谢你。我提供了下面的代码和我当前问题的屏幕截图+我的目标。提前谢谢你,祝你度过愉快的一天 HTML: //// I do show my live count by triggering the id="countBalance" from my ajax script <h3 id="countBalance"><sup styl

如何以逗号形式显示计数?目前,即使它是千种形式,它也没有使用逗号。有什么办法可以让它工作吗?先谢谢你。我提供了下面的代码和我当前问题的屏幕截图+我的目标。提前谢谢你,祝你度过愉快的一天

HTML:

//// I do show my live count by triggering the id="countBalance" from my ajax script

    <h3 id="countBalance"><sup style="font-size: 20px"> Php</sup></h3>
<script>
function liveBalance(){

  $.ajax({          
            url:'<?=site_url('masteragent/liveBalance')?>',
             type: "POST",
            dataType:"json",
            success:function(data){
            $('#countBalance').html(data);
 
            }
      });





}
setInterval(function(){ 
liveBalance() 
},1000);

</script>
function liveBalance(){
    
    
    
    $output=$this->masters->live_balance();
    
    echo json_encode($output);
}
型号:

 function live_balance(){
        
        $reqamount= $this->session->userdata('uid');
        
        $this->db->select('balance');
        $this->db->where('maID',$reqamount);
        
        $result = $this->db->get('prefunding_ma')->row();
        
        return $result->balance;
    }

亲爱的在你的控制器改变

echo json_encode($output);


使用数字方法哇,效果很好。我不知道事情这么简单。我只知道PHP中的回声号格式,但不知道ajax/script中的回声号格式。谢谢你。非常感谢。
echo json_encode(number_format($output));