我在我的网站上有这个按钮
<input class="large button gray input" id="refrescar" type="submit" value="Confirmar"/>我使用它来手动刷新站点,如下所示:
$('#refrescar').click(function() {
location.reload();
});它在我的网站上几乎所有的页面上都能工作,除了那些有如下参数的页面:
http://mywebsite.com/page.php?id=2当我单击该页面中的按钮时,它将转到
http://mywebsite.com/page.php 而不是。
我该如何解决这个问题呢?
发布于 2011-06-27 19:32:53
使用type="button"代替type="submit",因为我认为当前按钮提交表单而不是重新加载它。
发布于 2011-06-27 19:36:54
是的,您需要改为
<input class="large button gray input" id="refrescar" type="submit" value="Confirmar"/>至
<input class="large button gray input" id="refrescar" type="button" value="Confirmar"/>发布于 2011-06-27 19:37:41
也许吧
location.reload(location.href);,它将把url和查询字符串传递给reload函数。
https://stackoverflow.com/questions/6492139
复制相似问题