Adding function options to autocomplete

I’m trying to add some functionality for the ‘beforeSend’ on autocomplete, I want to replace the search button to a loading icon when requesting auto complete values from the server.

So the code I might have is:

$this->widget('zii.widgets.jui.CJuiAutoComplete', array(



	'value' => $this->search_keywords,

	// additional javascript options for the autocomplete plugin



		'beforeSend' => 'function() { // add some functionality here for  loading icon }'




		'alt' => t('Search for goals...')



The problem is that the output of the code is putting quotations around the ‘function() …’ part of the ‘beforeSend’ so its treating it as a JavaScript string rather than code.

Hope this is clear?

Try with the js: to mark it as script code

'beforeSend' => 'js:function() {...}