How to refresh a page in a backbone application

后端 未结 13 2185
北恋
北恋 2021-01-30 22:32

I am using backbone to build my web app.

Currently I am facing an issue whereby if I am on the home page, I am unable to refresh the same page by just clicking on the \'

13条回答
  •  一个人的身影
    2021-01-30 22:56

    You could also just make a meaningless change to the url by adding a random number to the end:

    var url = $(this).attr('href') + '?rand=' + Math.floor(Math.random() * 1000);
    Backbone.history.navigate(url, true);
    

    This is especially useful for IE since it will not request new data via an AJAX call if the url has not changed.

提交回复
热议问题