'POST', 'data'=>array('field1'=>'value1', 'field2'=>'value2'), 'success'=>'function(data) { // do something with returned data }' )); ?>
'POST', 'data'=>array(), 'success'=>'function(data) { $("#myDiv").html(data); }' )); ?>This code creates an ajax button with label "Update Div". When clicked, it sends a POST request to the "updateDiv" action with no data attached. Once the request is successful, the returned data is used to update the contents of a div element with ID "myDiv". Package/Library: Yii Framework