Results 1 to 5 of 5

Thread: Partial Page Refresh Problem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2009
    Posts
    968

    Partial Page Refresh Problem

    Hi Guys,

    Im using the code below to refresh the contents of a specific div on my webpage. But the problem I'm having is that when it refreshes it removes the contents completly rather than actually refreshing it. Anyone got any ideas on what the problem may be ?

    Code:
    setInterval(function() {  
    $("#content").load(location.href+" #content>*","");  
    }, 10000); //10 seconds to wait, miliseconds
    Last edited by dunlop03; Dec 31st, 2012 at 10:54 AM.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2009
    Posts
    968

    Re: Partial Page Refresh Problem

    Any ideas anyone ?

  3. #3
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Partial Page Refresh Problem

    Are you sure you have the correct usage of load()? Use a debugging tool to check that the url passed into load() is correct. Also, if you're using jQuery, why not just do this:

    JavaScript Code:
    1. $("#content").delay(10000).load(url);
    Last edited by tr333; Jan 1st, 2013 at 05:13 PM.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2009
    Posts
    968

    Re: Partial Page Refresh Problem

    Quote Originally Posted by tr333 View Post
    Are you sure you have the correct usage of load()? Use a debugging tool to check that the url passed into load() is correct. Also, if you're using jQuery, why not just do this:

    JavaScript Code:
    1. $("#content").delay(10000).load(url);
    We'll... I'm not sure to be honest. Im basically just trying to refresh a specific DIV (#content) without reloading the entire page.

  5. #5
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Partial Page Refresh Problem

    The source of the div tag would need to be in its own file in the first place... so that your JQuery loads just that piece... your original load (as well as the one from tr333) would load the WHOLE PAGE into the div... which might be why you're seeing an empty div field, because the nested html is actually breaking it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width