Jquery In Yii

hi im newb to this framework and i have done some sample codes and when i started to add jquery in my samples i dono how to do it. is there any a link or reference or good tutorial for jquery in yii framework i have seen most links they all just about definiton oly and they are good.

. pls post some links and tuts for it . thanks in advance


this code for subscribe/unsubscribe link

and you must have to include jqury css and js file in your view file

<p>Click to 

                    <a class="link" onclick="subscribe(<?php echo $subscribe->id; ?>);"><span id="subtext">

                    <?php if(isset($subscribe->newsletter_subscribe) && $subscribe->newsletter_subscribe==1)


                                echo "unsubscribe";

                            } else {

                               echo "subscribe"; }




                    monthly newsletter



    function subscribe(id)


        subs = $("#subs").val();



             { type: "POST",

                url: "<?php echo Controller::createUrl('home/subscribe');?>",


                success: function(data)






                        msg = "subscribe";



                        msg = "unsubscribe";


                    $('#msg').html('<div class=\"flash-success\">'+msg+'</div>').fadeIn();

                    setTimeout( 'jQuery(\'#msg\').fadeOut();',3000 );





Google can help you.

I’'l try to give you my help. First of all, type this code to add jquery to your web pages:


Then, type this to add your own script:




or if you are using themes:




Finally, you can work on your jquery file:


    // ...


Try to keep separate javascript and php.

thanks that was really helpful. i tried the basic and it worked out thank you