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
Re: Partial Page Refresh Problem
Any ideas anyone ? :confused:
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);
Re: Partial Page Refresh Problem
Quote:
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.
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