Can't Assign Jquery Value To Session Variable In Yii

In the following code the value item.rmid is provided by jQuery. The value is fetched from database, displayed in item.rmid and has to be stored in Yii::app()->SESSION[“rid”] but it’s not working.

In view I have the following code:


        $.each(<?php echo $ar; ?>, function (i, item) {


<div class="title">


    <?php Yii::app()->SESSION["rid"]=' + item.rmid + ' ; ?>"

    <?php echo Yii::app()->SESSION["rid"];?>



What am I doing wrong?