Reputation: 115
I have this rating script, when people click on any of the stars It allow people to clic again to update but I want people just to clic one time and load a message to DIV like "thanks for your vote" and clear our the stars.
current función https://co.angelesinfieles.com/profileview/rating/
<script>
// rating script
$(function(){
$('.rate-btn').hover(function(){
$('.rate-btn').removeClass('rate-btn-hover');
var therate = $(this).attr('id');
for (var i = therate; i >= 0; i--) {
$('.rate-btn-'+i).addClass('rate-btn-hover');
};
});
$('.rate-btn').click(function(){
var therate = $(this).attr('id');
var dataRate = 'act=rate&post_id=<?php echo $id; ?>&ip=<?php echo $_COOKIE["PHPSESSID"]; ?>&rate='+therate; //
$('.rate-btn').removeClass('rate-btn-active');
for (var i = therate; i >= 0; i--) {
$('.rate-btn-'+i).addClass('rate-btn-active');
};
$.ajax({
type : "POST",
url : "<? echo $domain ?>profileview/rating/ajax.php",
data: dataRate,
success:function(){}
});
});
});
</script>
<div class="rate-ex1-cnt">
<div id="1" class="rate-btn-1 rate-btn"></div>
<div id="2" class="rate-btn-2 rate-btn"></div>
<div id="3" class="rate-btn-3 rate-btn"></div>
<div id="4" class="rate-btn-4 rate-btn"></div>
<div id="5" class="rate-btn-5 rate-btn"></div>
</div>
Upvotes: 0
Views: 153
Reputation: 5013
$.ajax({
type : "POST",
url : "<? echo $domain ?>profileview/rating/ajax.php",
data: dataRate,
success:function(data){
alert (data); // data is your return value
}
});
Upvotes: 1