jeudi 26 mars 2015

How to refresh particular page in rails

I have a dashboard page which needs to refresh after every 15 minutes. So how can I do this.


Here is my dashboard action from my controller



def dashboard
@widgets = Widget.all
end


I have already added "Refresh" button on the page.


dashboard.html.haml



= link_to "Refresh Page", "#", :id => "refresh-page"


dashboard.js



$("#refresh-page").click(function(){
location.reload();
});


I also tried with



<meta http-equiv="refresh" content="300" />


and it is working fine page is refreshing after 5 minutes but it is applying to the all pages and this is causing problem.


So how can I refresh only particular page.


Aucun commentaire:

Enregistrer un commentaire