Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8473591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:23:36+00:00 2026-06-10T17:23:36+00:00

I need to create a script in jQuery and PHP that will show a

  • 0

I need to create a script in jQuery and PHP that will show a load more news button only when there is more data to load that’s not already on the page. The easiest solution would be to test if a table has been updated but i’m not sure that can be done. Another way would be to test if there is content in the table that is not currently on the page, again not sure how to do this.

This is what I have so far;

//check for more data every 5 seconds
window.setInterval(function() {
    $.get("phpscripts/getFeed.php", function(result) {
        //fade in #refreshFeed
        $("#refreshFeed").fadeIn(300);
    }); 
}, 5000);

//Get feed on click
$("#refreshFeed").live('click', function() {
    $.get("phpscripts/getFeed.php", function(result) {
        $("#newsFeed").html(result);
    }); 
});

This just makes the button show up after 5 seconds and does not test if there is more data to load. The php script in the second function just loads data from a table.

I would hope there is a way to use the same script in the function at the moment and do it all in jQuery.

Just as an example, if anyone has ever been on twitter or the new facebook app for iphone the concept is exactly the same. When there is new information in the database a button is shown that will load that data to the top of the feed when clicked. I am sure facebook and twitter will use SSE though but I don’t need to do that. All i need to do is check for new data every 5 seconds.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:23:37+00:00Added an answer on June 10, 2026 at 5:23 pm

    I just finished two view more link features on a site and I can tell you from the performance testing that we did that your best bet is to load all of the data and add it to the DOM on page load into elements with display: none. Use a jQuery selector to get all those elements and store the collection in a variable. You can then write your view more/less scripts for those elements.

    If you need any help with the scripts let me know and I’m happy to help. Good luck! 🙂

    Edit:

    I think I may have missed part of your question (how to know when to hide or show the buttons). You will want to keep a variable that you use to store how many items you ate showing and slice to show more/less. Alternatively (but with more overhead) you can use classes as flags to determine what elements are and are not shown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a script and I need to create a loop that will execute
How create a link_to_remote in a jQuery script where url need a parameter that
I need to create a script where someone will post an opening for a
I need to create a piece of script that looks through a variety of
I need to create an ejabberd user from a PHP script. I also need
i have a php script where i need to create a zip archive with
I need to have script.sh , that would create files f1.txt and f2.txt with
I have jQuery Ajax request that sends data to a PHP page that then
I am trying to create a form that utilizes PHP and Jquery AJAX form
I need to create a bash shell script starting with a day and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.