小编Jer*_*rad的帖子

我想使用 Laravel 7 将我的查询输出传递到 jQuery 图表 js

我想在折线图中显示每个月的注册学生人数。我从查询中得到了结果,但我无法理解如何在折线图 js 文件中传递值。请帮助解决这个问题。我附上了输出的代码和屏幕截图。

我想将查询输出数据传递给jQuery 数据:[0, 4, 9, 18, 21, 34, 20, 35, 45, 53, 49, 60],

应用程序.js

(function ($) {
  "use strict"; // Chart
  if ($('#report-line-chart').length) {
    var ctx = $('#report-line-chart')[0].getContext('2d');
    var myChart = new chart_js__WEBPACK_IMPORTED_MODULE_1___default.a(ctx, {
      type: 'line',
      data: {
        labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
        datasets: [{
          label: '# of total',
          data: [0, 4, 9, 18, 21, 34, 20, 35, 45, 53, 49, 60],
          borderWidth: 2,
          borderColor: '#3160D8',
          backgroundColor: …
Run Code Online (Sandbox Code Playgroud)

php jquery charts laravel

7
推荐指数
1
解决办法
206
查看次数

推特喜欢使用css的按钮动画

我在网上找到了动画代码,当我点击图像时,它会再次播放动画来说明部分。我想做的是当我单击图像时它会播放动画并停止动画再次单击它应该重置图像,任何人都给我反馈如何做到这一点..

.like-btn-svg {
  width: 80px;
  height: 100px;
  position: absolute;
  left: 25px;
  bottom: -112px;
  transform: translate(-50%, -50%);
  background: url(https://abs.twimg.com/a/1446542199/img/t1/web_heart_animation.png) no-repeat;
  background-position: 0 0;
  animation: fave-like-btn-svg 1s steps(28);
  cursor: pointer;
}

.like-btn-svg:hover {
  background-position: -2800px 0;
  transition: background 1s steps(28);
}

@keyframes fave-like-btn-svg {
  0% {
    background-position: 2800px 0;
  }
  100% {
    background-position: -2800px 0;
  }
}
Run Code Online (Sandbox Code Playgroud)
<div class="like-btn-svg"></div>
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

3
推荐指数
1
解决办法
3441
查看次数

通过AJAX页面插入是令人耳目一新的

通过AJAX插入数据它正在工作,但页面刷新,为什么提供反馈来解决这个问题.

这是我的ajax代码

 <script>
        $(document).ready(function(){
            $("#button").click(function(){

                var postId=$("#postId").val();
                var userId=$("#userId").val();
                var postComm=$("#postComments").val();

                $.ajax({
                    url:'../validate/inserPostComm.php',
                    method:'POST',
                    data:{
                        poId:postId,
                        usId:userId,
                        poco:postComm
                    },
                   success:function(data){
                       //alert(data);
                   }
                });
            });
        });
    </script>
Run Code Online (Sandbox Code Playgroud)

我在这里使用HTML

<form>
<input type="hidden" id="postId" name="postId" value="<?php echo $_GET["postId"]; ?>">
<input type="hidden" id="userId" name="userId" value="<?php echo $_SESSION["u_id"]; ?>">
<textarea placeholder="Post your comment" id="postComments"></textarea>
<button type="submit" id="button"><i class="fa fa-paper-plane"></i></button>
</form> 
Run Code Online (Sandbox Code Playgroud)

javascript php ajax jquery

0
推荐指数
1
解决办法
102
查看次数

标签 统计

jquery ×3

javascript ×2

php ×2

ajax ×1

charts ×1

css ×1

html ×1

laravel ×1