Welcome Guest, Not a member yet? Register   Sign In
Ajax Framework (CJAX) Refresh a <DIV> each X seconds
#3

[eluser]Ajaxboy[/eluser]
Code:
//in your controller
$ajax->call('ajax.php?my_controller/my_function","div_Id");

//in  your response
class My_controller {

public function my_function()
{
$ajax = ajax();
$ajax->wait(5);// wait 5 seconds
$ajax->call('ajax.php?my_controller/my_function","div_Id"); //repeats operation after 5 seconds
echo date("j, n, Y", time());  // prints the date/time, which will be returned to the div.
}


}

There is a wait() function allows you to do time interactions, there is not an interval function but that is a good idea to add in a future release. The above code should get the job done.


Messages In This Thread
Ajax Framework (CJAX) Refresh a <DIV> each X seconds - by El Forum - 11-02-2013, 03:41 PM
Ajax Framework (CJAX) Refresh a <DIV> each X seconds - by El Forum - 11-03-2013, 05:14 AM
Ajax Framework (CJAX) Refresh a <DIV> each X seconds - by El Forum - 11-04-2013, 05:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB