samedi 17 avril 2021

trying to reload the page a number of times after a form submission

i use memberstack to stock the url of the avatar image of the members , but memberstack dont refresh the image after the url change , so i need to refresh the page a certain number of times to get the avatar refreshed.

I have found this code and enhanced it but i dont know why it dosent execute , seems there is an error can you find it?

<script> 
    var Webflow = Webflow || [];
    Webflow.push(function() {
    $("#wf-form-avatarform").submit(function (event) {
            var timeinmilliseconds = 3000;
            var reloadCnt = window.sessionStorage.getItem( "reloadCounter") ?
                parseInt(window.sessionStorage.getItem( "reloadCounter")) + 1 :
                1;

            window.sessionStorage.setItem( "reloadCounter", reloadCnt );
            if ( reloadCnt <= 3 ){
              setTimeout(function(){ window.location.reload(true); }, timeinmilliseconds);
            }
        });
   });
</script>



Aucun commentaire:

Enregistrer un commentaire