简体   繁体   中英

Load success message into a DIV

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>
           $.ajax({
                type : "POST",
                url : "<? echo $domain ?>profileview/rating/ajax.php",
                data: dataRate,
                success:function(data){
                 alert (data); // data is your return value
                }
            });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM