【发布时间】:2015-05-28 13:16:16
【问题描述】:
这是我的 HTML 按钮:
<button class="button-brightgreen" onclick="cancelbutton();">Cancel</button>
这是我的 JavaScript 重定向:
function cancelbutton() {
var cancelURL = 'http://localhost:51937/php/searchUsers.php';
$(location).attr('href', cancelURL);
}
这是在我的 editUser.php 页面上。这段代码对我来说很好,除非当前 URL 中有一个 php GET 字符串,例如 ?user_id=19
当 URL 中有 GET 并且我单击取消按钮时,它会将我带回到同一页面 (editUser.php) 并显示 ""
当当前 URL 中有 GET 时,如何使重定向工作?
【问题讨论】:
-
试试
javascript: window.history = "http://localhost:51937/php/searchUsers.php";
标签: javascript php html url redirect