<a> href=# 与 JS 刷新页面的关系

这个问题折腾了我好久,我在<a href='#' id ='cc'>ddddd<a> 

在JS 中绑定 “cc” 点击事件,在点击的时候 进行AJAX 请求,请求完成之后刷新页面。

location.href = location.href;

location.replace(location.href); 

history.go(-1);

这些刷新都测试了,都不执行。

最终发现 原因就是因为  href='#' ,改为‘/’或‘’ Jquery Ajax会报异常 执行error,

最后直接把href 属性直接去掉。就好了。

原文地址:https://www.cnblogs.com/90nice/p/3125842.html