CHtml::ajax - javascript syntax error

Hi!

I writng now ajax delete.

This is my view for ListView:




<div class="ui-widget-content ui-corner-all" style="width: 188px; padding: 10px; float: left; text-align: left;">

    <a href="#" onclick="<?php echo CHtml::ajax(array('url'=>'/Panel/NewsCategory/AjaxDelete/','data'=>array('id'=>$data->id),'type'=>'POST','update'=>'#categories'));?>"><span class='ui-icon ui-icon-trash' style='float: left; margin-right: .1em;'></span></a>

    <span class='ui-icon ui-icon-pencil' style='float: left; margin-right: .1em;'></span>

<?php echo $data->name;?>

</div>



and when I’m click on every link i’m getting syntax errot (in firebug) and nothing is happening.

Can you help?

I’d check this data, trying something like


'data'=>CJson::encode(array('id'=>$data->id))

If this way doesn’t solve, can you pelase write more specific what error you got?