newbie questions re php include refresh script
I'm totally new to AJAX/JQuery and am learning on the fly -- thanks to a lot of searching through these forums. I'm looking for some help on my first project.
I found and modified a script that would load php into a div and refresh the div without refreshing the whole page:
-
<script>
var refreshId = setInterval(function()
{
$('#refresh').fadeOut("slow").load('script.php').fadeIn("slow");
}, 60000);
</script>
Frightfully simple, I know. Two questions:
(1) I would prefer to have the div changes "cross-fade" rather than fading in/out. The php is basically a running list that will keep expanding. A cross-fade will give the illusion of the next item fading into visibility. I have found different transition effects, but not cross-fading.
(2) The script works perfectly once it loads the div the first time. (It displays a spinner gif until it loads the content.) But the initial load takes about 20-30 seconds, in contrast to an near-instant load if I use curl or include functions outside of JQuery/AJAX
Any help with these would be greatly appreciated!