I am using jRating a star rating found on
http://www.myjqueryplugins.com/jquery-plugin/jrating
on that same page, they have options that you can configure as you pleased. except one that I’m looking for.
I like to have a default value let say 1, 2 or 5 star rating for some images. How can I can do that? I’m using jQuery and ajax or xml to get data from the server and assign it to the option that I couldn’t find. I do not know anything about php so their example wasn’t helpful at all. any help will be great. Thank you.
<script type="text/javascript">
$(document).ready(function(){
$(".exemple2").jRating({
rateMax: 5,
showRateInfo: false,
isDisabled:true,
value: 3,<----------- option like this is not available how can I can do this
length : 5 // nb of stars
});
});
</scrip>
<!-- basic exemple -->
<div class="exemple">
<!-- in this exemple, 12 is the average and 1 is the id of the line to update in DB -->
<div class="exemple2" id="12_1"></div>
<!-- in this other exemple, 8 is the average and 2 is the id of the line to update in DB -->
<div class="exemple2" id="8_2"></div>
</div>
From what I understand from the examples and the source, you need to name the id of the div where you set up your rating component such that it should be something like x_y.
where x is the proportion of rating that you want to give.
For example if you want to have total 5 stars (length = 5) in your system. Examples:
[The score is calculated from 20. Number of stars is configurable]
You may fetch the data in whichever manner you please to, however, while creating the divs for rating, you will have to follow this naming convention to use this plugin [from what I understand].