Hello,
how can I call an ajax response from a javascript code (not php) in a view?
Thanks
Hello,
how can I call an ajax response from a javascript code (not php) in a view?
Thanks
Simple,
User JQuery.ajax();
<?php echo CHtml::ajaxLink(
'hello',
array('site/somepage'),
array(
'update' => '#content'
)
); ?>
<div id="content"></div>
<script type="text/javascript">
<?php echo CHtml::ajaxLink(
'hello',
array('site/somepage'),
array(
'update' => '#content'
)
); ?>
</script>
<div id="content"></div>
This doesn’t work for me. Should be php code really used in javascript, since js is client-side?
Thanks
You should use it as
<?php echo CHtml::ajaxLink(
'hello',
array('site/somepage'),
array(
'update' => '#content'
)
); ?>
<div id="content"></div>