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

  • SEARCH
  • Home
  • 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 7589505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:10:36+00:00 2026-05-30T20:10:36+00:00

Possible Duplicate: jQuery refresh if PHP file echo's 'true' I have the following div

  • 0

Possible Duplicate:
jQuery refresh if PHP file echo's 'true'

I have the following div on my index:

<div id='tv'> <? include 'tv.php' ?> </div>

I have a script that changes content in tv.php and returns ‘true’ at a certain time called checktime.php.

I’m trying to have jQuery in the index header to check the PHP page every 10 seconds and if checktime.php returns ‘true’ jQuery ‘refreshes’ the content of the #tv div. This is the code I currently have but it’s not working. It seems to check checktime.php but the div doesn’t automatically refresh.

<script src="http://code.jquery.com/jquery-latest.js"></script>

<script type="text/javascript">
$(document).ready(function(){
    setInterval("checkTime()", 10000);
    function checkTime(){
        $.ajax({
            url: 'checktime.php',
            success: function(refresh){
                if($.trim(refresh) == "true"){
                    $('#tv').load('tv.php');
                }   
            }
        });
    }

});
</script>
  • 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-05-30T20:10:37+00:00Added an answer on May 30, 2026 at 8:10 pm

    See if this works better for you, you need to adjust SetInterval to work with jQuery:

    $(document).ready(function(){
        setInterval(function() {
            $.ajax({
                url: 'checktime.php',
                success: function(refresh){
                    if($.trim(refresh) == "true"){
                        $('#tv').load('tv.php');
                    }   
                }
            });
        }, 10000);
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What does jQuery.fn mean? I have some script on a page trying
Possible Duplicate: jQuery bind click ANYTHING but ELEMENT I have this HTML <div id=outer>
Possible Duplicate: jQuery delay between animations I have created two functions: One that animates
Possible Duplicate: jQuery: get the file name selected from <input type=file /> I have
Possible Duplicate: jQuery - is it bad to have multiple $(document).ready(function() {}); Can you
Possible Duplicate: jquery/ajax load new content when available i have a table named news
Possible Duplicate: JQuery to check for duplicate ids in a DOM Suppose i have
Possible Duplicate: Stop default hashtag behavior with jquery I have some jquery code on
Possible Duplicate: What is the $ in jQuery? We know that $ is an
Possible Duplicate: JQuery datepicker- 2 inputs/textboxes and restricting range Hi i have two pickers

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.