大家看我做的JQ+AJAX哪里有错误
时间:2009-06-27
来源:互联网
<script type="text/javascript">
$(document).ready
(
function()
{
$("#form").submit
(
function()
{
login();
return false;
}
);
}
);
function login()
{
var qq = $("#qq").val();
var password = $("#password").val();
if (qq == "")
{
$("#confirm").text("请输入登录用户名");
$("qq").focus();
return false;
}
if(password == "")
{
$("#confirm").text("请输入登录密码");
$("#password").focus();
return false;
}
$.ajax({
type: "get",
url: "index.php?c=adviser&a=ajax",
data: "id=" + qq + "&p=" + password,
beforeSend: function(){
$("confirm").text("登录中,请稍候");
},
success: function(msg){
if(msg == "success"){
$("#confirm").text("登录成功");
}else {
$("#confirm").("没有此用户或者密码不正确!");
}
}
});
}
</script>
<form action="{{url controller=adviser action=check}}" method="post" style="display:{{$islogout}}" name="form" id="form" >
<div class="maincenter1">顾问帐号:<input type="text" name="qq" id="qq" style=" border:#FFCC00 1px solid;background-color:#000000; width:200px; color:#FFFFFF;"> </div>
<div class="maincenter1">登录密码:<input type="password" name="password" id="password" style=" border:#FFCC00 1px solid;background-color:#000000;width:200px; color:#FFFFFF;"></div>
<div class="maincenter2"><input type="submit" value="登录" id="submit" name="submit" style="border:#000000 1px solid; height:30px; width:72px; color:#4d4d4d;background:url(images/denglu.jpg) no-repeat; line-height:30px; line-height:30px; overflow:hidden;"><img src="{{$image_path}}/zhuce.jpg" />
<!--<input value="注册" style="border:#000000 1px solid; height:30px; width:72px;background:url(images/denglu.jpg) no-repeat; line-height:30px; color:#4d4d4d; line-height:30px; overflow:hidden;padding-left:20px;">-->
<a href="{{url controller=adviser action=register}}" style="background:url(images/denglu.jpg);background-repeat:no-repeat; width:72px; height:30px;color:#4d4d4d;padding-left:20px; padding-top:7px;">注册</a>
</div>
</form>
$(document).ready
(
function()
{
$("#form").submit
(
function()
{
login();
return false;
}
);
}
);
function login()
{
var qq = $("#qq").val();
var password = $("#password").val();
if (qq == "")
{
$("#confirm").text("请输入登录用户名");
$("qq").focus();
return false;
}
if(password == "")
{
$("#confirm").text("请输入登录密码");
$("#password").focus();
return false;
}
$.ajax({
type: "get",
url: "index.php?c=adviser&a=ajax",
data: "id=" + qq + "&p=" + password,
beforeSend: function(){
$("confirm").text("登录中,请稍候");
},
success: function(msg){
if(msg == "success"){
$("#confirm").text("登录成功");
}else {
$("#confirm").("没有此用户或者密码不正确!");
}
}
});
}
</script>
<form action="{{url controller=adviser action=check}}" method="post" style="display:{{$islogout}}" name="form" id="form" >
<div class="maincenter1">顾问帐号:<input type="text" name="qq" id="qq" style=" border:#FFCC00 1px solid;background-color:#000000; width:200px; color:#FFFFFF;"> </div>
<div class="maincenter1">登录密码:<input type="password" name="password" id="password" style=" border:#FFCC00 1px solid;background-color:#000000;width:200px; color:#FFFFFF;"></div>
<div class="maincenter2"><input type="submit" value="登录" id="submit" name="submit" style="border:#000000 1px solid; height:30px; width:72px; color:#4d4d4d;background:url(images/denglu.jpg) no-repeat; line-height:30px; line-height:30px; overflow:hidden;"><img src="{{$image_path}}/zhuce.jpg" />
<!--<input value="注册" style="border:#000000 1px solid; height:30px; width:72px;background:url(images/denglu.jpg) no-repeat; line-height:30px; color:#4d4d4d; line-height:30px; overflow:hidden;padding-left:20px;">-->
<a href="{{url controller=adviser action=register}}" style="background:url(images/denglu.jpg);background-repeat:no-repeat; width:72px; height:30px;color:#4d4d4d;padding-left:20px; padding-top:7px;">注册</a>
</div>
</form>
作者: 411439140 发布时间: 2009-06-27
首先是dataType是什么,text么,设置一下error参数把你的出错信息显示出来
其次是登录不应该用GET,因为密码是以URL明文发送的,这样很容易被拦截和攻击,是对用户的不负责
其次是登录不应该用GET,因为密码是以URL明文发送的,这样很容易被拦截和攻击,是对用户的不负责
作者: keakon 发布时间: 2009-06-27
type:'post'
作者: quweiie 发布时间: 2009-06-29
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28