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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀