get server side response from ajax button

Hi there,

I have ajax submit button. After submitting the form, response from server is updating a div which is given as update parameter in ajax array. 

Now what I want is to catch the response in the javascript instead of updating div. Meaning I want to call a javascript function on success or complete and want to get the response in the javascript veriable.

How I can do that ?

Plz help me out.

Thanks in advance.

Instead of using the ‘update’ parameter, set ‘success’ to be a function like so:

CHtml::ajaxButton($label, $url, array(


    'success'=>'function(msg) { window.alert(msg); }',