$(this) doesn't refer to the element on which the jRate function is being called.
You can use the selector if there is only a single element having that class
$('.star-rating').jRate({
startColor : '#ccc',
endColor : '#ccc',
readOnly : true,
rating : $('.star-rating').data('star-rating')
});
For multiple elements:
Iterate over all the elements having the class star-rating and attach the plugin jRate individually with the rating value of the respective element.
$('.star-rating').each(function () {
$(this).jRate({
startColor: '#ccc',
endColor: '#ccc',
readOnly: true,
rating: $(this).data('star-rating')
});
});
JSFiddle DemoDidn't find CDN link of that plugin, so added the minified code in JavaScript pane itself