Dear all,
I try to use an extension called DzRaty for Star Rating on CGridView which worked fine for me. However, I have a problem with escape string that took several hours but I still couldn’t solve it. My problem is like this:
array(
'name' => 'score',
'class' => 'ext.DzRaty.DzRatyDataColumn',
'value'=>'$data->score',
'options' => array(
'readOnly' => FALSE,
'space' => FALSE,
'path' => Yii::app()->request->baseUrl. '/img' ,
'click' => "js:function(score, evt){
$.ajax({
type: \"POST\",
url: \"http://localhost/client/update\",
data: \"id=$data->id_client&score=\" + score,
success: function(msg){
alert(\"Thank you for your feedback!\")
},
error: function(xhr){
alert(\"failure\"+xhr.readyState+this.url)
}
})
}",
),
),
The issue come at the line
data: \"id=$data->id_client&score=\" + score,
as PHP compiler complaining about Undefined variable: data . If I change
$data->id_client
to 1 or any valid client PK it works. Could anyone please kindly help? Thank you in advance!
Ackley