I’m trying to update an image via ajaxLink. The image has a unique css id and the function does return a valid response. I tried to work with the update property but I just don’t get it working. So here are my snippets:
My View (part):
echo CHtml::ajaxLink('<img id="'.$data['combatIdent'].'" src="/images/icn_share'.$data['shareFlag'].'.png">', 'ajaxRequest', array(
'type'=>'POST',
'data'=>array(
'crAction'=>'updateShareFlag',
'combatIdent'=>$data['combatIdent'],
'shareFlag'=>$data['shareFlag'],
),
));
My Controller (part):
public function actionAjaxRequest() {
// Switch CR share flag
if($_POST['crAction'] == 'updateShareFlag') {
$model = new combatReport();
$model->combatIdent = $_POST['combatIdent'];
$model->shareFlag = $_POST['shareFlag'];
$shareFlag = $model->switchShareFlag();
echo $shareFlag;
}
}
I bet it’s quite easy but I just don’t get it