看这篇之前建议大家去看看前面两篇文章:
现在写一下$.getjson里面的主要内容:
$.getJSON("doindex.jsp",{email:$("#email").val()},function(data){
alert(data.msg);
$("#semail").html(data.msg);
});
然后在看看doindex.jsp里面的内容:
String email = request.getParameter("email");
if("2451999120@qq.com".equals(email)){
out.print("{"flag":true,"msg":"<font color='red'>该邮箱已注册!</font>"}");
}else{
out.print("{"flag":false,"msg":"<font color='green'>可以使用!</font>"}");
}