[英]Force user to reload page
Background information: 背景资料:
/path/to/file.js?v=20160511
/path/to/file.js?v=20160511
That problem I need to solve now is when I make a change to the data that is returned by the AJAX call (I assume this is considered an API break), and the JavaScript file (client). 我现在需要解决的问题是,当我更改由AJAX调用返回的数据(我认为这被认为是API中断)和JavaScript文件(客户端)时。 My first thought would be to somehow force the user to reload the page when I release a change to the API.
我的第一个想法是在发布对API的更改时以某种方式迫使用户重新加载页面。 What is a good process to make sure the client and server stay in sync?
有什么好的方法来确保客户端和服务器保持同步?
您可以使用AJAX在客户端上触发“ location.reload();”。
Based on Uğurcan 's comment and Hullu2000 's answer , I added two things to my current implementation. 基于Uğurcan的评论和Hullu2000的回答 ,我在当前的实现中添加了两件事。 The total necessary items are:
总共需要的项目是:
/path/to/file.js?v=20160511
/path/to/file.js?v=20160511
window.location.reload();
window.location.reload();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.