Passing An Id Using An Ajaxbutton

The answer is most likely simple, but I’m still having trouble with it after reading a lot of passing variables using ajax and yii. Hopefully someone can quickly clear up my problem and I’ll learn something new.

I have ajaxButtons that will create and delete all. They work just fine, because they don’t require any record id’s to function. Here is what I have:

View:


CHtml::ajaxButton('Remove',array('ticket/RemoveItem'),array('type'=>'post','item_id'=>$item['id'],'update'=>'#item_list'))

Controller:




public function actionRemoveItem()

	{	

		echo $_POST['$item_id'];

	}

For the sake of understanding I would just like to be able to echo the item id I’m trying to pass. Thanks!

How about this:

Link:


array('ticket/RemoveItem', 'id' => $item['id'])

Controller:


public function actionRemoveItem($id)

Thanks, so simple. I don’t know why I kept trying to stick the value on the end.