使用ajax php加载帖子时显示“不再发布帖子” [英] Show 'no more posts' when loading posts using ajax php
本文介绍了使用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加载帖子时显示“不再发布帖子”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文