briang
(Briang)
July 1, 2011, 5:58am
1
Anyone know why the following piece of code gives a syntax error?
<div id="locationsBtn" class="menubutton" onclick="<?php echo CHtml::ajax(array(
'update'=>'#mainarea',
'type'=>'POST',
'url'=>array('location/index'),
'data'=>array('clientID'=>$client->clientID)
));
?>">
</div>
Thanks in advance.
shailesh
(Shailesh Makwana990)
July 1, 2011, 6:39am
2
plz try in these Way
<div id="locationsBtn" class="menubutton" onclick=\"<?php echo CHtml::ajax(array(
'update'=>'#mainarea',
'type'=>'POST',
'url'=>array('location/index'),
'data'=>array('clientID'=>$client->clientID)
));
?>\">
briang
(Briang)
July 1, 2011, 4:48pm
3
Thanks for the reply, but that just gave amn illegal character error. Anyone else have a solution?
atti
(Atti84it)
July 5, 2011, 3:52pm
4
why don’t u copy and paste the exact message for the syntax error?
is it a PHP error or javascript error?
briang
(Briang)
July 5, 2011, 4:03pm
5
Thanks for the reply.
The error just said syntax error in the javascript that CHtml::ajax creates. I’ve scrapped using the onclick event and wrote my own jQuery function, which seems to work.
22francis
(Jesusloves Francis)
January 16, 2012, 4:58am
6
user CHtml::tag for div
<?php echo CHtml::tag(‘div’,array(
'onClick'=>CHtml::ajax(array(
'type'=>'POST',
'url'=>array('contoller/action'),
// ‘success’=>‘function(data) {}’
'update'=>'#main',
)
),
'class'=>'box',//html option
),'',true
);
?>