[eluser]alexaaaaaaaaaa[/eluser]
Hi i've just implemented into one of my projects stars rating and it's working finally...
here's the code
view
Code:
[removed]
$(function(){
$('#form3 :radio.star').rating();
});
[removed]
<form id="form3A" />
<?php foreach($polls_choices as $polls_choice) { ?>
<p> <?php echo $polls_choice->choice; ?>
<div >
<input class="<?php echo $polls_choice->id; ?>" type="radio" name="<?php echo $polls_choice->id; ?>" id="auto-submit-star" value="1"/>
<input class="<?php echo $polls_choice->id; ?>" type="radio" name="<?php echo $polls_choice->id; ?>" id="<?php echo $polls_choice->choice; ?>" value="2" />
<input class="<?php echo $polls_choice->id; ?>" type="radio" name="<?php echo $polls_choice->id; ?>" id="<?php echo $polls_choice->choice; ?>" value="3"/>
<input class="<?php echo $polls_choice->id; ?>" type="radio" name="<?php echo $polls_choice->id; ?>" id="<?php echo $polls_choice->choice; ?>" value="4"/>
<input class="<?php echo $polls_choice->id; ?>" type="radio" name="<?php echo $polls_choice->id; ?>" id="<?php echo $polls_choice->choice; ?>" value="5"/>
</div>
<br/>
< script >
$(function(){
$('.<?php echo $polls_choice->id; ?>').rating({
callback: function(value, link){
$.getJSON('index.php/poll/ajax_rating/' + value + '/' + <?php echo $polls_choice->id; ?> + '/' + <?php echo $this->uri->segment(3); ?> + '/' + <?php echo $account->id; ?>);
}
});
});
< / script >
controller
Code:
function ajax_rating($rate_id)
{
echo $rate_id. " " .$this->uri->segment(4). " " .$this->uri->segment(5). " " .$this->uri->segment(6);
}
For js files and documentation here
http://www.fyneworks.com/jquery/multiple...b-Examples
No spam just if there's someone asking how to implement this i'll be glad to guide him as much as i can.
Regards,
Alex
PS. use if(IS_AJAX){ ..insert data } else { redirect what ever you want to do} just a small security thing and after you submit the rating you can easy hide ans show a div with the results what ever you want ...