CodeIgniter Forums
xajax dropdown problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: xajax dropdown problem (/thread-23265.html)



xajax dropdown problem - El Forum - 10-05-2009

[eluser]crwtrue[/eluser]
Code:
class Testxajax extends Controller
{

    function Testxajax()
    {
    parent::controller();
        $this->load->library('xajax');
    $this->load->helper('url');
        $this->xajax->registerFunction(array('test_function',&$this,'test_function'));
        $this->xajax->processRequest();
    }

function test_function()
    {
        
        $objResponse = new xajaxResponse();
    $Ol =array();
    $Ol= $this->Cars_model->getCars();
        
    $ret = '';
        
    for($i=0; $i<count($Ol); $i++)
    {
    $ret .= '<option value="'.$Ol[$i]['Model'].'">'.$Ol[$i]['Model'].'</option>';    
    }
        
    $objResponse->assign('cars', 'innerHTML', $ret);
        
        
        return $objResponse;
    }
    
    function index()
    {
    $data = array();
    $data['title'] = 'Test;
    $data['xajax_js'] = $this->xajax->getJavascript(base_url());
    $data['content'] = '&lt;form name="carform" method="post" action="post"  id="carform"&gt;&lt;select name="cars" id="cars"><option value="">(No Selection)</option></select>&lt;/form&gt;';

    $data['main'] = 'testxajax_view';
    $this->load->vars($data);
    $this->load->view('template');
    }
  
}

I installed xajax on my ci application. Iam trying to fill a dropdown with car models but when i click the dropdown it just comes smaller and its empty. Any ideas?