我想在 ajaxoptions 的选项中捕获 javascript/PHP 变量。例如;
CHtml::ajaxLink("My link", Yii::app()->createUrl('controller/definition'), array(
'data' => array("id" => $model->id),
'type' => 'POST',
'error' => 'js:function(data){}',
'beforeSend' => 'js:function(request){}',
'success' => 'js:function(data){
alert(jQuery(this).attr("id"));
alert({$model->id});
}',
'complete' => 'js:function(data){}',
//'update'=>'#where_to_put_the_response',
), array(
"confirm" => "Are you sure you want to delete?",
"id" => "linkID",
"href" => "javascript:;",
"title" => "mTitle"
)
);
在成功选项中,我有两个警报向您展示我想要它的方式。哪个不显示正确的数据。有没有办法获取 php 变量和 jQuery(this) 对象?