Jqueryy - Set Data In Beforesend Function

Hi,

I am trying to set data in beforeSend function.




	echo CHtml::ajaxLink('', Yii::app()->createUrl('Ajax/UserRestaurant'),

			array( // ajaxOptions

				'data' => array(),

				'beforeSend'=>"function(xhr, s) {

					s.data += \"&newProp=newValue\";

				}",

			),

			array( //htmlOptions

				'id' => 'star',

			)

		);



However, no data is sent. What do I do wrong?

Thank you, Martin.

I think, this is possible only for post request.

This works fine. Thank you for your help.




	echo CHtml::ajaxLink('', Yii::app()->createUrl('Ajax/UserRestaurant'),

			array( // ajaxOptions

				'beforeSend'=>"function(xhr, s) {

					s.data += '&rid=1';

				}",

				'type' => 'post',

				'dataType' => 'jsonp',

				'contentType' => 'application/x-www-form-urlencoded; charset=UTF-8'

			),

			array( //htmlOptions

				'id' => 'star',

			)

		);