Recharger une page en fin de code jquery

freetibet1 -  
bonobo47 Messages postés 142 Date d'inscription   Statut Membre Dernière intervention   -
Bonsoir à tous,

J'ai récupéré un système de vote par étoiles en html, jquery et php. J'aimerais, en fin d'exécution du Jquery, rajouter un bout de code afin de faire recharger ma page. Je ne maitrise pas du tout ce langage, aussi, je fais humblement appel à vos connaissances et compétences. Le code est le suivant, grand merci d'avance.

 $(document).ready(function() {
       
        $('.rate_widget').each(function(i) {
            var widget = this;
            var out_data = {
                widget_id : $(widget).attr('id'),
                fetch: 1
            };
            $.post(
                'ratings.php',
                out_data,
                function(INFO) {
                    $(widget).data( 'fsr', INFO );
                    set_votes(widget);
                },
                'json'
            );
        });
   

        $('.ratings_stars').hover(
            // Handles the mouseover
            function() {
                $(this).prevAll().andSelf().addClass('ratings_over');
                $(this).nextAll().removeClass('ratings_vote');
            },
            // Handles the mouseout
            function() {
                $(this).prevAll().andSelf().removeClass('ratings_over');
                // can't use 'this' because it wont contain the updated data
                set_votes($(this).parent());
            }
        );
       

        // This actually records the vote
        $('.ratings_stars').bind('click', function() {
            var star = this;
            var widget = $(this).parent();           
            var clicked_data = {
                clicked_on : $(star).attr('class'),
                widget_id : $(star).parent().attr('id')
            };

            $.post(
                'ratings.php',
                clicked_data,
                function(INFO) {
                    widget.data( 'fsr', INFO );
                    set_votes(widget);                                   
 
                },
                'json'
            );
        });
       
     
 
       
    });

    function set_votes(widget) {

        var avg = $(widget).data('fsr').whole_avg;
        var votes = $(widget).data('fsr').number_votes;
        var exact = $(widget).data('fsr').dec_avg;
   
        window.console && console.log('and now in set_votes, it thinks the fsr is ' + $(widget).data('fsr').number_votes);
       
        $(widget).find('.star_' + avg).prevAll().andSelf().addClass('ratings_vote');
        $(widget).find('.star_' + avg).nextAll().removeClass('ratings_vote');
        $(widget).find('.total_votes').text( votes + ' votes enregistres, moyenne de ' + exact + '/5' );
    }
A voir également:

1 réponse

bonobo47 Messages postés 142 Date d'inscription   Statut Membre Dernière intervention   13
 
window.location.reload() 


?
0