Calling AJAX response from JS in a view

Hello,

how can I call an ajax response from a javascript code (not php) in a view?

Thanks

Simple,

User JQuery.ajax();

http://api.jquery.com/category/ajax/

<?php echo CHtml::ajaxLink(

    'hello',


    array('site/somepage'),


    array(


        'update' =&gt; '#content'


    )

); ?>

<div id="content"></div>

<script type="text/javascript">

<?php echo CHtml::ajaxLink(

    'hello',


    array('site/somepage'),


    array(


        'update' =&gt; '#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>