How to create url in JS

Hi all,

I’m very new in Yii.

I’m building a search box using ESelect2 extention.

When a item is selected, I want to run controller to process selected data.

In view:




           <?php

           $this->widget('ext.select2.ESelect2',array(

              'name'=>'search_job',

              'data'=> CHtml::listData(Job::model()->findAll(), 'id', 'name'),

              'htmlOptions'=>array(

                  'id'=>'search_box',

                  'multiple'=>true,

                  'placeholder'=>'Tìm kiếm Plan',

                  'allowClear'=>true,

                  'class' => 'search-box',

                  'onclick'=>'job_search()',

                ),

                'options'=>array(

                        'minimumInputLength'=>1,

                ),

            ));

             ?>



So, what I should do in plan_search() to create url.




// Search box

function job_search(){

    var id = document.getElementById('search_box').value;

    // What I should to do next ?

}



I looked for other posts, they’re using Ajax, but I dont know about Ajax.

If you have other solution, please help me to solve this.

Thanks in advance.

ajax is very straightforward using jquery instead of javascript

http://www.w3schools.com/jquery/ajax_ajax.asp

Thanks for the link.

I solved my problem.

I tried to post my solution, but this website warned me that "Your post seems to be a spam…".