Dear All,
Could some one please give me the correct syntax to call controller from Java script?
Here is the case , I have below code . In auto complete after selecting the value I want to pass the selected value and drop down value ( the first line in the code) to some other controller . Could some one please let me how to do this ( Not using ajax call , I want to redirect to that controller) ? I have put alert(ui.item.value) statement temporarily on select event …
Thank You
<?php echo CHtml::dropDownList('type','',array('1'=>'Company','2'=>'Profession','3'=>'People')); ?>
<?php
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'searchAuto',
'id' => 'searchAuto',
'value' =>'Search',
'source'=>'js: function(request, response) {
$.ajax({
url: "'.$this->createUrl('myAutoComplete/autoCompleate').'",
dataType: "json",
data: {
term: request.term,
brand: $("#type").val()
},
success: function (data) {
response(data);
}
})
}',
'options' => array(
'showAnim' => 'fold',
'minLength' => '2',
'select' => 'js:function(event, ui){ alert(ui.item.value) }',
),
'htmlOptions' => array(
'onFocus' => 'document.getElementById("searchAuto").value=""'
)
));