Cjax Framework

Recursive ajax requests demo shows you how you can trigger ajax requests from the server, and if you can trigger an ajax request from the server, then you can do it recursively. First an ajax request is initiated, it goes to the ajax controller. Ajax controller, updates counter, and fires another ajax request to itself. This is truly non-asynchronous because it does not trigger all the requests at once, rather it wait for one to finish, and the ajax request itself triggers the next one until the count total is matched.




<input type='button' id='button1' value ='Start recursive requests'/>
<div id='div_counter'></div>

Try it

How many ajax requests would you like?.



class recursive_ajax {

call($counter 0,$count)
//force valid inputs
$counter = (int) $counter;
$count = (int) $count;


$ajax ajax();

//if you enter a number greate than 100
if($count 100) {

//focus on textbox

//show warning
$ajax->warning("Too many requests can add overhead to our servers, please try reducing the number.");

//update textbox
$ajax->count 30;

//update div
$ajax->div_counter "Call# $counter..";

$counter>=$count) {
$ajax->div_counter "$counter recursive AJAX requests were made.";
        } else {

//fire call




Previous Topic:  Previous Class    ·   Top of Page   ·   Demos Home   ·  

CodeIgniter  ·  Copyright © 2006 - 2012  ·  Cjax