Hi.
I’m using JuiTabs in my application and I would like refresh that content every X seconds.
Do anyone knows how to do that ??
Hi.
I’m using JuiTabs in my application and I would like refresh that content every X seconds.
Do anyone knows how to do that ??
What I would do is that the content of the Tab has a layer with an ID and then, on render the HTML, write a javascript function that makes use of setInterval that makes an AJAX call and change that layer.
Ok. But I’m newbie with Yii and JS. Could You give some example how to do that ?
I tried to register seperate script file in view file:
Yii::app()->clientScript->registerScriptFile($surl, CClientScript::POS_HEAD);
and this is that file:
function refreshstat() {
$.ajax({
url: 'astat/Club.php',
success: function(data) {
$('#club').html(data);
}
});
setTimeout("refreshstat()", 1000);
}
$(document).ready(function(){
refreshstat();
}
I have DIV with id=“club” inside the tabs but actually it doesn’t work
why do you want to refresh it? what is the reader is reading what is there? what if they have selected some text? what if they have scrolled? it will all be gone in the refresh. You need to have empathy for your users.
and you’re going to poll your server every few seconds from every computer? i hope you have few users or many servers.
why don’t you give the user the option to refresh? if there’s no content, show a refresh icon, otherwise don’t.
That will be radio statistics like who is playing and name of audition, who is playing next, etc. so I have to refresh it. Content will be just few words, so it shouldn’t use so much my serwer.
Usually Web radio are using <iframe> which is worst than ajax call
I have resolved problem (wrong paths).
Now I have another one. I have to use some Yii functions in that file which is loaded by AJAX.
I’ve got error message: Fatal error: Class ‘Yii’ not found