Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.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
Php 淡入特定帖子的内容?_Php_Jquery_Ajax_Wordpress - Fatal编程技术网

Php 淡入特定帖子的内容?

Php 淡入特定帖子的内容?,php,jquery,ajax,wordpress,Php,Jquery,Ajax,Wordpress,我试图获得类似on的效果,这样当我单击一个div时,jquery会获取当前单击的div的id并将其存储在一个变量中 $(function (){ $('.project-wrapper').click(function() { var id = $(this).attr('id'); jQuery.ajax({ type: 'post', url:'wp-cont

我试图获得类似on的效果,这样当我单击一个div时,jquery会获取当前单击的div的id并将其存储在一个变量中

$(function (){ 
    $('.project-wrapper').click(function() { 
        var id = $(this).attr('id');

        jQuery.ajax({
            type: 'post',                    
            url:'wp-content/themes/MartinFjeldUpdated/header.php',   
            dataType : 'HTML',         
            data:{"id" : id},             
            success: function(rs)
            {
                $(".display-video-image-graphic-fade").fadeIn(500);
            }
        });  
    }); 
});
然后我想把这个变量转换成一个php变量,这样就可以通过点击帖子的缩略图自动改变我想要淡入的内容

<?php
    $paged = $_post['id'];
    $args= array(
        'id' => $paged,
    );

    query_posts($args);; if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div data-id="<?php echo get_the_ID();?>" class="display-video-image-graphic-fade">
        <div class="display-outer-frame">
            <div class="display-middle-frame">
                <div class="video-frame">
                    <div id="slider">
                        <ul class="slides">
                            <?php the_content(); ?>
                        </ul>
                    </div>
                </div>
                <div class="title">
                    <h3 class="title-head"> <?php echo the_title(); ?></h3>
                </div>
                <div class="options">
                    <div class="inliner back-forth">
                        <div id="left" class="arrows">
                            <img src="wp-content/themes/MartinFjeldUpdated/images/left.pdf">
                        </div>
                        <div id="right" class="arrows">
                            <img src="wp-content/themes/MartinFjeldUpdated/images/right.pdf">
                        </div>
                    </div>
                    <div class="inliner out-cross">
                        <div class="cross">
                            <img src="wp-content/themes/MartinFjeldUpdated/images/cross.pdf">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php endwhile; else : endif; ?>
不知怎的,它不起作用。。我是一个真正的业余爱好者,所以如果你需要更多的解释,请让我知道,我会尽我最大的努力。
谢谢。

添加$+id.htmlrs;在成功中,什么不起作用?jqueryfadein还是数据?如果jQuery fadeIn不工作,请尝试$.display-video-image-graphic-fade.slideDown@SunilPachlangia当我这样做时,整个html页面加载到div中。。。我不认为这是正确的方法,但我认为你在做一些事情@BhupenderKeswani是数据没有返回正确的value@Snik1我建议您通过在输出中打印post id来调试代码。还有一些修正$\u POST caps,而不是使用/wp-content/themes/MartinFjeldUpdated/images/cross.pdf使用/images/cross.pdf,也应该是png或gif,而不是pdf