[eluser]doctoroakin[/eluser]
Im fooling around with building a CI app and I love the framework. I am trying to refresh a div in my view every 10 seconds and my code is not working. Does anyone have experience with this?
My Controller
Code:
<?php
class Response extends CI_Controller {
public function left()
{
$this->load->model('points');
$data['FighterOneScore'] = $this->points->get_FighterOneScore();
echo $data['FighterOneScore'];
}
public function right()
{
$this->load->model('points');
$data['FighterTwoScore'] = $this->points->get_FighterTwoScore();
echo $data['FighterTwoScore'];
}
}
?>
My View code
Code:
var auto_refresh = setInterval(
function ()
{
$.get("<?php echo base_url(); ?>response/left",
function(data){ $("#load_score").html($data); } // not sure about fadeIn here!
);
}, 10000); // refresh every 10000 milliseconds
<div id="load_score"></div>
Any help would be greatly appreciated