-
Dec 31st, 2012, 10:12 AM
#1
Thread Starter
Fanatic Member
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.
-
Jan 1st, 2013, 03:05 PM
#2
Thread Starter
Fanatic Member
Re: Partial Page Refresh Problem
Any ideas anyone ?
-
Jan 1st, 2013, 05:10 PM
#3
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:
$("#content").delay(10000).load(url);
Last edited by tr333; Jan 1st, 2013 at 05:13 PM.
-
Jan 1st, 2013, 05:34 PM
#4
Thread Starter
Fanatic Member
Re: Partial Page Refresh Problem
Originally Posted by tr333
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:
$("#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.
-
Jan 1st, 2013, 06:23 PM
#5
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|