jQuery.JSON conflict ......

Dear all,

I am using Cstar rating and using jQuery.JSON instead of ajax. (from this post http://www.yiiframework.com/forum/index.php/topic/29851-complete-guide-for-multiple-cstarratings-on-same-page/).

Here is my functions. each time I use it in my view.php, All jquery plugin in my page will disappear and disabled.

Also, the CstarRating will change to radio buttons instead of stars.

I guess there are some conflicts… any ideas?


 $this->widget('CStarRating',array(

         'name'=>'rating'.$model->rating_id, // an unique name

        'starCount'=>5,

        'readOnly'=>false,

        'resetText'=>'',

        'value'=>$value, 

    'callback'=>' 

        function(){

                url = Yii::app()->request->requestUri."/rating";

                $jQuery.getJSON(url, {id: '.$model->rating_id.', val: $(this).val()}, function(model) {

                if (model.status == "success")

                {

                $("#rating_success_'.$model->rating_id.'").html(model.div);

                $("#rating_success_'.$model->rating_id.'").fadeIn("slow");               

                var pause = setTimeout("$(\"#rating_success_'.$model->rating_id.'\").fadeOut(\"slow\")",5000);

                $("#rating_info_'.$model->rating_id.'").html(model.info);

                $("input[id*='.$model->rating_id.'_]").rating("readOnly",true);

                }

                });

                }'

                        ));

Best

This should cause a javascript error and all the script will stop functioning.

Didn’t you check it in your firebug or something?

I just fixed this line to url = "/notes/rating";

I used firebugs…it tells me I have a syntax error at line:


$jQuery.getJSON(url, {id: , val: $(this).val()}, function(model) {

However, I really have no ideas about what error it is…

The value for ‘id’ is missing in the 2nd parameter of getJSON().

You should check if your $model->rating_id has a proper value or not.

That is absolutely correct…I add a value in the rating_id column and it works like a charm now…

Thank you so much!!!!

Cheers