iam new in yii framework how to create like and dislike comment count and store database using ajax pls help anybody
iam new in yii framework how to create like and dislike comment count and store database using ajax pls help anybody
Simply create a ajax link and pass parameters in it according to your specification. then in controller action save the data.
You can refer this link
And i hope you are clear with the logic behind like dislike.
So you just need to create one action in controller file and pass parameter in it eg.
array('post_id'=>1,'status'=>'like')
and please change dislike link according the condition.
Then call this ajax link it will work.
i want to onclick based display the values also how to at the same time display like count values in database
YeAh this is what i am saying…refresh the div or something with ajax response after updating a result with new like or dislike…
from controller action return something like
return $likeCount;
or your can return json opbject like
$array = array('like_count'=>$likeCount,'dislike_count'=>$dislikeCount);
return CJSON::encode($array);
Then update your div with the ajax response.
how to increase upcount or like count in database field values ,which condition pass in the controller please help