Cjax Framework


Propagate dropdowns with ajax

Examples


PHP
<?php 

$ajax
->change("dropdown1",$ajax->call("ajax.php?dropdown/propagate/|dropdown1|"));


?>

Try it





Controller:
PHP
<?php 



class dropdown {

    function 
propagate($selected)
    {
        
$ajax ajax();
        
$data = array();


        switch(
$selected) {
            case 
'options':
                
$data[] = "Option 1";
                
$data[] = "Option 2";
                
$data[] = "Option 3";
                
$data[] = "Option 4";
                
$data[] = "Option 5";
            break;
            case 
'states':

                
$data[] = "Texas";
                
$data[] = "Florida";
                
$data[] = "New York";
                
$data[] = "California";
                
$data[] = "New Mexico";
                
$data[] = "Maine";
            break;
        }

        
$ajax->select('dropdown2',$data);

    }
}

?>

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

CodeIgniter  ·  Copyright © 2006 - 2012  ·  Cjax