473,382 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Show 'no more posts' when loading posts using ajax php.

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.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3.     $(document).on('click','.show_more',function(){
  4.         var ID = $(this).attr('id');
  5.         $('.show_more').hide();
  6.         $('.loding').show();
  7.         $.ajax({
  8.             type:'POST',
  9.             url:'mload_more.php',
  10.             data:'id='+ID,
  11.             success:function(html){
  12.                 $('#show_more_main'+ID).remove();
  13.                 $('.posts').append(html);
  14.             }
  15.         });
  16.  
  17.     });
  18. });
  19. </script>
Expand|Select|Wrap|Line Numbers
  1. <div class="show_more_main" id="show_more_main<?php echo $ID; ?>">
  2.  <span id="<?php echo $ID; ?>" class="show_more" title="Load more posts">Show more</span>
  3.  <span class="loding" style="display: none;"><span class="loding_txt">Loading...</span></span>
  4.  </div>
  5.  </div>
Oct 29 '15 #1

✓ answered by Dormilich

if you want to know if there are no more post while fetching the last batch of posts, you need an extra query to check if there are more posts available.

1 1247
Dormilich
8,658 Expert Mod 8TB
if you want to know if there are no more post while fetching the last batch of posts, you need an extra query to check if there are more posts available.
Oct 29 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Roy Wang | last post by:
hi, My problem is how to determining when the XML file has loaded using javascript. I loaded an xml file using javascript in a web page. The code below is loading the xml file for IE:...
3
by: Per Dunberg | last post by:
Hi all, I have to develop a "skinned" application and I have a problem with the graphics. When a form is loaded and displayed there's aways a flicker where all the controls are located on the...
5
by: Martin | last post by:
Hello NG, I've been doing some AJAX for a few weeks now. The basics worked fine so far, but now I've got the following problem which I can't solve: With AJAX you typically update/replace only...
5
by: Mukesh | last post by:
Hi i want to use AJAX.net in my Existing Application I have already installed the ajax .net ..net 3.0 and using VS 2005 in the old application i have added a new web form then script manager...
13
by: Marvin Zhang | last post by:
Hi, I'm not familiar with web programming, but I have a problem here. I have a page. When a user click one button on it, I will use AJAX to request a PHP script which will do a bunch of tasks,...
3
by: pjdelaere | last post by:
Hi, In a multiuser environment the following happens: for one user I load a page that contains external, internal and inline javascript; all runs well. If I load new internal or inline...
0
by: BaseballGraphs | last post by:
Hello, I am trying to use Ajax in order to improve the speed of my website. I am trying to pull data from a dynamic page and insert the data onto the current page. There are 3 three things I am...
7
by: rigaconnect | last post by:
I have drop down menu. If visitor selects certain option from drop down menu I need to show certain content (without page reload; so I need to use Ajax). At the same time I need save selection of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.