We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Refresh the page after pressing submit on widget form | Forum

Offir
Offir Apr 22 '13
Is there a way to refresh the page after the user submits a form. I ask this because I have a form that creates a newsfeed activity but it can only be seen after the page has been refreshed. 
Michael I.
Michael I. Apr 24 '13

If you're using an Ajax form, refresh the page using JS. Specify what exactly your form does if you need more information.

MarkieMark67
MarkieMark67 Apr 27 '13
Offir Here is a simple code that can be modified many different ways, and can be placed all most anyplace. It is setup to do a whole page refresh. But it's a start for you.


<script>

    var time = new Date().getTime();

    var refreshTime = 600*1000;


    $(document).bind("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error hover change", function(e) {

    time = new Date().getTime(); });


    function refresh()

    {

       if(new Date().getTime() - time >= refreshTime)

           window.location.reload(true);

       else

    setTimeout(refresh, refreshTime);    

      }

  

     setTimeout(refresh, refreshTime);


</script>

The Forum post is edited by MarkieMark67 Jun 11 '14