1.
$.ajax({ type:"post",dataTyep:"json",async: false,//取消异步 url:"check_username.jspx",data:{ username:username },success : function(result) { if (result.result == 0) { $("#uName").show(); $("#uName").html("用户名已经使用"); flag = false } else { $("#uName").hide(); flag = true } } })
2.
$.post($("#registform").attr("action"),$("#registform").serialize(),function(result) { if(result.success) { layer.msg("注册成功!"); setInterval("window.location.href = '/';",1000); return ; } layer.msg("注册失败!" + result.FailedMessage); });