Hi all
I want to implement search using AJAX
at present I am using following code.I am new to AJAX so that is why i need some help
//this adds a javascript event listener to the search box that will query the server with each keystroke. yw0 is the id of the clistview. q is the id of the text input box:
Yii::app()->clientScript->registerScript('search', "
$('input#q').keyup(function(){
$.fn.yiiListView.update('yw0', {
data: $(this).serialize()
});
return false;
});
");
Search Box HTML
<div id="serach_box">
<label> Search : </label><input width="200" type="text" id="q" name="q" />
</div>
Controller
public function actionIndex()
{
if(isset($_GET['q']))
{
$model = new Hotel($scenario='search');
$model->unsetAttributes();
$model->name = $_GET['q'];
$this->render('index',array(
'dataProvider'=>$model->search(),
));
}
$dataProvider=new CActiveDataProvider('Hotel', array(
'pagination'=>array(
'pageSize'=>20,
),
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
Now QUESTION IS
How can you get additional values in for example with the text box input I want to have search according to city ,price and so on there would be different drop down for all.
I am a bit confused