嗨,我有一个登录系统的jQuery ajax请求.起初,它运作良好.但经过几次尝试后,它才刚刚开始出现负面反应.我检查了萤火虫,它说响应是,在我的情况下"连接".但是ajax响应只显示"Not_connected".我不知道该怎么办:(请帮帮我.
这是我的jquery代码:
var data_str = "username="+usrn+"&password="+pwd;
$.ajax({
type: "POST",
url: "index.php?rnd=" + Math.random(),
data : data_str,
complete : function(xhr,data){
if(data == 'connected'){window.location.href = 'admin.php';}
else if(data = 'not_connected'){ error_gen.html('Invalid username or password'); }
alert(data);
}
});
Run Code Online (Sandbox Code Playgroud)
AS代码为PHP代码:
$log_result = $u_obj->login_user();
if($log_result == true)/*user is connected*/
{
echo 'connected';
exit;/*stoping the script after sending the result*/
}
elseif($log_result == false)/*error while logging in*/
{
echo 'not_connected';
exit;/*stoping the script after sending the result*/
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试找到一种解决方案来从有序列表中选择某个 Id 之后的行列表。
例如,首先我选择 1000 行。然后,在后续请求中,我想从第一个请求的最后一个 id 之后获取另外 1000 行。我知道我可以做到这一点,但假设在第一个和第二个请求之间添加了 100 行,那么第一个请求将有 100 行。
这两个查询都将按条目的日期排序。
这是我想到的查询示例:
$query = "SELECT * FROM table WHERE id AFTER $id ORDER BY date DESC";
Run Code Online (Sandbox Code Playgroud)