jquery获取exception的message

<script type="text/javascript" language="javascript">

        function checkLoginForm() {
            var userName = $("#loginId").val();
            var userPassword = $("#password").val();
            var orgId = $("#orgId").val();
            var validateCode = $("#ValidateCode").val();

            if (userName == "" || userName == null) {
                alert("请输入用户名");
                return false;
            }
            if (userPassword == "" || userPassword == null) {
                alert("请输入密码");
                return false;
            }
            if (orgId == "" || orgId == null) {
                alert("请输入机构ID");
                return false;
            }
            if (validateCode == "" || validateCode == null) {
                alert("请输入验证码");
                return false;
            }
            //非空验证结束
            var params = $("#loginForm").formToArray();
            $.ajaxSettings['contentType'] = "application/x-www-form-urlencoded; charset=utf-8";
            $.ajax({
                    type:"POST",
                    url:"<c:url value='/admin/modules/core/sysuser.json'/>",
                    data:params,
                    dataType: "json",
                    success:function(data){
                                if(data.success == "true"){
                                alert("成功登录");
                                location.href="<%=request.getContextPath()%>/admin.html";
                                }
                            },
                    error:function(XMLHttpRequest, textStatus){                        
                        if(XMLHttpRequest.status==500){
                            var result = eval("("+XMLHttpRequest.responseText+")");
                            alert(result.exception.message);
                          }
                        }
                   });
            return false;
        }
    </script>
 

你可能感兴趣的:(JavaScript,jquery,c,Ajax,json)