I'm fooling around with a codeigniter 2.X app and I'm trying to use the following Jquery code to update a number every 10 seconds in my view.
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_score').load('<?php echo $FighterOneScore; ?>').fadeIn("slow");
}, 10000); // refresh every 10000 milliseconds
</script>
And this is my div tag in my view
<div id="load_score"> </div>
UPDATE
Here is my controller code
public function left()
{
$this->load->model('points');
$data['ScoreOne'] = $this->points->get_ScoreOne();
echo $data['ScoreOne'];
}
public function right()
{
$this->load->model('points');
$data['ScoreTwo'] = $this->points->get_ScoreTwo();
echo $data['ScoreTwo'];
}
}
?>
Here is the Javascript I have in My VIEW:
<script type="text/javascript">
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
</script>
When I load my view in the browser - The page shows nothing.