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 8245153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:05:19+00:00 2026-06-07T22:05:19+00:00

I have a page laid out with 2 Div’s on the page. The first

  • 0

I have a page laid out with 2 Div’s on the page. The first Div works fine and loads a list of players. Now when you click on a link in that Div, it loads a second Div with information about that player. That too works fine, but what I want to do is have that second Div periodically refresh that players data after it being loaded by the click event. Here was my current attempt but it’s not working:

var loc = "";
$("a").live('click', function() {
    loc = "player.php?user=" + $(this).html();
    $("#result").load(loc);
});
setInterval(function() {
    $("#results").load(loc);
}, 1000);
  • 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-07T22:05:21+00:00Added an answer on June 7, 2026 at 10:05 pm

    Try moving the setInterval inside the click event handler so that it doesn’t fire off before the first click and you ensure the loc is defined before the first interval completes.

    Also, you may have a typo within your setInterval, as it refers to $('#results'), not $('#result'). One or the other is likely incorrect.

    Finally, it’s good practice to assign a setInterval to a variable, so that you can clear it later, if needed with clearInterval. it also lets you set the interval just once, rather than every time the user clicks

    var loc = "";
    var interval = null;
    
    $("a").live('click', function(){
        loc = "player.php?user=" + $(this).html();
    
        $("#result").load(loc);
    
        // only create the interval once
        if(!interval) {
            interval = setInterval(function(){
                $("#result").load(loc);
            }, 1000);
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that is laid out using DIV s, and it essentially
If my code is laid out like so, <div data-page-index=1 class=active> <img src=foo.png />
I have a web page that is laid out in HTML and has some
I have data thats being laid out to the page in divs and the
I have page which is redirected from htaccess. now I can pass the German
Ok, I have page one(index), fully functional and working fine as is with all
The way this page is laid out, all of the data is loaded at
I have a number of DIVs currently laid out in an oval shape. Each
I have a webpage laid out as follows... |----------------------| | |----------| | | |
I have page with some div which have relative position and i want to

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.