dpwdldgn43486 2014-11-02 23:22
浏览 41
已采纳

jquery进度条与php变量

I would like to ask how can i use my own values for progress bar which will show how much credit u spent until your preset maximum budget? input types are text to see if value comes in. it does. Progress bar has some progress but that is because i manually entered both values. http://postimg.org/image/fbjnrvvgn/

CODE:

<input type="text" id="max_budget" value="<?php include_once 'budget_calc.php'; echo $max_budget_echo; ?>">
<input type="text" id="calculated_budget" value="<?php include_once 'budget_calc.php'; echo $total ?>">
<script>
$(function() {
$( "#progressbar" ).progressbar({
  max: 1000,
  value: 100
});
});
</script>
<div id="progressbar"></div>

I would like to have max from user set max in database and value calculated from $total=$i-$o, like this:

 <script>
$(function() {
$( "#progressbar" ).progressbar({
 max: $('#max_budget').val(),
  value: $('calculated_budget').val()
});
});
</script>

I have also tired this:

<script>
var max_budget=<?php include_once 'budget_calc.php'; echo $max_budget_echo; ?>
var calculated_budget=<?php include_once 'budget_calc.php'; echo $total; ?>
$(function() {
$( "#progressbar" ).progressbar({
max: max_budget,
value: calculated_budget
});
});
</script>

But nothig works :( How can i solve this problem? Thank you for your time (:

  • 写回答

2条回答 默认 最新

  • dongyi7901 2014-11-02 23:45
    关注

    Why dont you just 'echo' them where you need them?

    <?php include_once 'budget_calc.php'; ?>
    <script>
    $(function() {
    $( "#progressbar" ).progressbar({
    max: <?php echo $max_budget_echo; ?>,
    value: <?php echo $total; ?>
    });
    });
    </script>
    

    If this wont work, check your HTML/JS-Code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器