Reputation: 2652
'success'=>'js: function(data) {
$("#addToListDialog$model->product_id").dialog().dialog("close");}'
I'm trying to write the above piece of javascript, but can't get the right combination of curly brackets a single/double quotes in order to resolve the PHP variable. How should I be writing this?
Upvotes: 1
Views: 175
Reputation: 985
Your PHP string must be in double quotations.
This should do the trick:
'success'=>"js: function(data) {
$(\"#addToListDialog{$model->product_id}\").dialog().dialog(\"close\");}"
Upvotes: 1
Reputation: 2623
A cleaner way:
'success'=>'js: function(data) {
$("#addToListDialog'.$model->product_id.'").dialog().dialog("close");}'
Upvotes: 3