Welcome Guest, Not a member yet? Register   Sign In
Ajax periodical refresh using jquery
#1

[eluser]hackersapien[/eluser]
I've implemented using codeigniter and jquery, a periodic refresher that basically reloads a div every few seconds. The javascript is working well and using firebug I can see the request being sent and the response, the only problem is that the <div> in my view isn't loading the response, I'm not sure its a javascript problem since firebug has no errors so I think its a problem with the CI code.

Javascript
Code:
function callMeOften()
{
      $.ajax({
                    method: 'get',
                    url : '&lt;?=base_url();?&gt;index.php/kids/getpic/&lt;?=$id?&gt;',
                    dataType : 'text',
                    success: function (text) { $('updateMe').html(text); }
                 });

}

var holdTheInterval = setInterval(callMeOften, 5000);

CI Controller Code

Code:
function getpic($id=null)
    {
        $data['profilepic']=$this->profilepicture->getProfilePic($id);
        $this->load->view('kids/getpic',$data);
    }
CI View Code- getpic.php
Code:
&lt;?php if($profilepic!=""){
    echo  img(array('src'=>$profilepic,'border'=>'1'));
}else{
    echo  img(array('src'=>'img/nopic.png','alt'=>'nopic','border'=>'1'));
}
?&gt;

If you got any idea where i'm going wrong, please assist me.


Messages In This Thread
Ajax periodical refresh using jquery - by El Forum - 10-30-2008, 03:42 PM
Ajax periodical refresh using jquery - by El Forum - 10-30-2008, 04:21 PM
Ajax periodical refresh using jquery - by El Forum - 10-30-2008, 04:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB