Show button only if there is more data to load
<p>I need to create a script in jQuery and PHP that will show a <code>load more news</code> 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.</p>

<p>This is what I have so far;</p>

<pre><code>//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);
    }); 
});
</code></pre>

<p>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.</p>

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

<p>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.</p>
