本文介绍了使用ajax php加载帖子时显示“不再发布帖子”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是javascript部分并加载更多按钮我正在使用它从数据库加载更多帖子它工作正常我想在所有帖子加载但不知道如何做的时候显示'没有更多帖子'的消息究竟。希望你们能提供帮助。
Below is the javascript part and load more button which I am using to load more posts from database it works fine I want to show a 'no more posts' message when all posts have been loaded but do not know how to do that exactly. Hope you guys can help.
<script type="text/javascript"> $(document).ready(function(){ $(document).on('click','.show_more',function(){ var ID = $(this).attr('id'); $('.show_more').hide(); $('.loding').show(); $.ajax({ type:'POST', url:'mload_more.php', data:'id='+ID, success:function(html){ $('#show_more_main'+ID).remove(); $('.posts').append(html); } }); }); }); </script>
<div class="show_more_main" id="show_more_main<?php echo $ID; ?>"> <span id="<?php echo $ID; ?>" class="show_more" title="Load more posts">Show more</span> <span class="loding" style="display: none;"><span class="loding_txt">Loading...</span></span> </div> </div>
推荐答案
( document )。ready( function (){ (document).ready(function(){
( document )。on(' 点击',' 。show_more', function (){ VAR ID = (document).on('click','.show_more',function(){ var ID =
( this )。attr(' id'); (this).attr('id');
更多推荐
使用ajax php加载帖子时显示“不再发布帖子”
发布评论