[eluser]Unknown[/eluser]
Hi.
i'am trying to use function call in cjax. but is not work.
and this my source :
application/administrator/example.php
Code:
class example extends CI_Controller {
function __constructs() {
parent::__construct();
require_once FCPATH.'ajaxfw.php';
}
function view() {
$ajax = ajax();
$ajax->click("button1",$ajax->call("ajax.php?recursive_ajax/call/0/30"));
$data['page'] = 'administrator_content/ex';
$this->load->view('container_administrator',$data);
}
}
and this in response/recursive_ajax.php
Code:
class recursive_ajax {
function call($counter, $count)
{
$counter = (int) $counter;
$count = (int) $count;
$counter++;
$ajax = ajax();
if($count > 100) {
$ajax->focus('count');
$ajax->warning("Too many requests can add overhead to our servers, please try reducing the number.", 5);
$ajax->count = 30;
return;
}
//update div
$ajax->div_counter = "Call# $counter of $count..";
if($counter>=$count) {
$ajax->div_counter ="$counter recursive AJAX requests were made.";
} else {
//fire call
$ajax->call("ajax.php?recursive_ajax/call/$counter/$count");
}
}
}
and this views/administrator_content/ex.php
Code:
<HTML>
<head>
<title>Example</title>
<!-- include cjax-5.6.js -->
</head>
<body>
<input type='button' id='button1' value ='Start recursive requests'/>
<div id='div_counter'></div>
</body>
</HTML>
please what wrong in my code?