php - Write the values of the ajaxoptions array dynamically using Yii -


i'm calling chtml::ajaxlink so:

        <?php echo chtml::ajaxlink('add list',             $this->createurl('itemlist/ajaxadditem'),             array(                 'onclick'=>'$("#addtolistdialog").dialog("open"); return false;',                 'type'=>'post',                 'update'=>'#addtolistdialog',                 'data' => 'js:{"product_id" : $("#productid").val()}'             ),             array('id'=>'showaddtolistdialog'));     ?> 

i don't know how write values of ajax options array dynamically. i'm using workaround value using javascript, $("#productid").val() , hidden field.

i want write like:

'data' => 'js:{"product_id" : "$model->product_id"}' 

but "$model->product_id" entered literal string.

can give me way this? method won't solve problem since need write ajax link multiple times on fly.

assuming $model instance available, should able append dynamically below: 'data' => "js:{'product_id' : '{$model->product_id}'}"


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -