How To Define Data Option In Ajaxsubmitbutton

I am trying to submit a form via ajax hence I am using ajaxSubmitButton along with CActiveForm. However, I would like to pass additional data along with the submit. How do I add that. Here is what I have but doesn’t work:

echo CHtml::ajaxSubmitButton('Submit', array('site/endpoint'), array('data'=>'{ajax: "endpoint-form"}'));


Dear Friend

Welcome to YII Forum.

Things can be done in the following way.I hope some nicer things exists.

//if we take the endpoint-form as id of the form element...

echo CHtml::ajaxSubmitButton('Submit',array('site/endpoint'),array(




		)); ?>