I'm using yii extension to draw graphs in my Yii application. The graph is to monitor the traffic of user. I want to refresh a <div> using jquery and ajax..
if there are two files in my view/abc folder
1--> a.php
2--> b.php
in file a ,i have written something like this:
<script type="text/javascript">
jQuery(function($) {
function updateData()
{
var html = $.ajax({
url: "<?php echo $this->createUrl('abc/b'); ?>",
success: function(data) {
$('#mydiv').html(data);
}
});
}
updateData();
var auto_refresh = setInterval(function(){
updateData()
}, 1000);
});
</script>
<div id='mydiv'> hii </div>
in file b,
<?php
echo "Hello......";
?>
i.e i want to refresh <div> written in file a with the content of file b in every 10 seconds
pls help me out!!
if there are two files in my view/abc folder
1--> a.php
2--> b.php
in file a ,i have written something like this:
<script type="text/javascript">
jQuery(function($) {
function updateData()
{
var html = $.ajax({
url: "<?php echo $this->createUrl('abc/b'); ?>",
success: function(data) {
$('#mydiv').html(data);
}
});
}
updateData();
var auto_refresh = setInterval(function(){
updateData()
}, 1000);
});
</script>
<div id='mydiv'> hii </div>
in file b,
<?php
echo "Hello......";
?>
i.e i want to refresh <div> written in file a with the content of file b in every 10 seconds
pls help me out!!

