javascriptprototypejssifr

update sIFR text after ajax update


I am using sIFR version 3 in my site. I am updating the text in a div with id 'points' from an ajax request. I want to update the text and apply the sIFR to that div after the text is changed.

Please suggest a solution.

here is my update code

new Ajax.Request('score.php', {
    onSuccess: function(response) {
       $('points').update(response.responseText);
    }
    });

Solution

  • Thanks for your comments . I figured out a way to use sIFR after Ajax update.

    new Ajax.Request('score.php', {
            onSuccess: function(response) {
               $('points').update(response.responseText);
               $('points').removeClassName('sIFR-replaced');
               applySIFR();
            }
            });
    

    the applySIFR(); function apply all the sIFR replacements once again.I think removing the class 'sIFR-replaced' from the element is the key to make it work.