【发布时间】:2015-08-29 01:32:53
【问题描述】:
从查询回显成功消息后,我的页面没有刷新。我已经尝试过 location.reload()、location.reload(true) 甚至尝试使用“loginFunction.php”页面中的标头进行重定向,但似乎没有任何效果。
jQuery
if ($.trim(user) != '' && password != '') {
$.post('includes/loginFunction.php', {
userName: user,
uPassword: password
}, function(data) {
var result = data;
if (data !== "success") {
$('#uNameE').text(data);
} else {
window.location.reload(true);
}
});
}
PHP
require_once('dbopen.php');
if(isset($_POST['userName']) === true && empty ($_POST['userName']) === false ){
$userName = $_POST["userName"];
$userPass = $_POST["uPassword"];
$query = $conn->query("SELECT * FROM members WHERE userN = '$userName' AND password = '$userPass'");
$num = $query->num_rows;
if($num != 0 ){
$_SESSION['usernameP'] = $userName;
//Header not working neither
//header('location: index.php');
echo "success";
}
else{
echo "Username or password incorrect";
}
}
【问题讨论】:
-
True 只是断言页面不应该从缓存中加载。
-
感谢您告诉我
-
根据您的浏览控制台,页面上是否还有其他 javascript 错误?
-
如果有任何错误,请查看控制台。
-
控制台没有错误
标签: javascript php jquery