weixin_33709609 2018-03-15 17:31 采纳率: 0%
浏览 28

Ajax光滑轮播

I'm using slick carousel in my project and it's not working properly.when I load data from the database through ajax it shows data but do not show as needed.slick's javascript or jquery are not loaded so, it does not look like a slide.

html part,

<div class="col-sm-12">
    <div class="responsive slidermenu" id="get_category">
        <!--
            <div class="cat-image-wrapper">
                <div class="single-book">
                    <div class="text-center">
                        <img class="menuimg" src="../Dv/upload/category/" alt=""/>
                        <a href=""></a>
                    </div>
                </div>
            </div>
        -->
    </div>
</div>

and ajax part

function category_c(){
    $.ajax({
        url :   "action.php",
        method: "POST",
        data    :{category:1},
        success :function(data){
            $("#get_category").html(data);
        }
    })
}

PHP part,

if(isset($_POST["category"])){
    $category_query = "SELECT * FROM category";
    $run_query = mysqli_query($con,$category_query) or die(mysqli_error($con));

    if(mysqli_num_rows($run_query) > 0){
        while($row = mysqli_fetch_array($run_query)){
            $cid = $row["category_id"];
            $cat_name = $row["category_name"];
            $cat_image = $row["category_icon"];
            echo "
                <div class='cat-image-wrapper'>
                    <div class='single-book'>
                        <div class='text-center'>
                            <img class='menuimg' src='../Dv/upload/category/$cat_image'/>
                            <a href=''>$cat_name</a>
                        </div>
                    </div>
                </div>
            ";
        }
    }
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

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