将成功消息加载到DIV中

时间:2015-04-06 08:50:42

标签: javascript ajax

我有这个评级脚本,当人们点击任何一个星星它允许人们再次clic更新但我希望人们只是clic一次并加载消息给DIV像“谢谢你的投票”并清除我们的星星。

currentfunciónhttps://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>

1 个答案:

答案 0 :(得分:1)

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