echo CHtml::ajaxLink('Click me', array('controller/action'), array( 'type' => 'GET', 'data' => array('param1' => 'value1'), 'success' => 'function(data){ $("#mydiv").html(data); }', ));
echo CHtml::ajaxLink('Click me', array('controller/action'), array( 'type' => 'POST', 'data' => 'js:{"param1": $("#myinput").val()}', 'beforeSend' => 'function(){ $("#loading").show(); }', 'complete' => 'function(){ $("#loading").hide(); }', ));This code creates a link with the text "Click me". When the link is clicked, it will send an AJAX POST request to the "controller/action" URL, passing the parameter "param1" with the value of an input element with an ID of "myinput". Before the request is sent, it will execute a JavaScript function that shows an element with an ID of "loading". After the request is complete, it will execute a JavaScript function that hides the "loading" element. Package/Library: Yii Framework.