Ajax实现提交多个参数

 $.ajax({
                url:"${pageContext.request.contextPath}/user/login",
                async:false,
                type:"post",
                data:{'userName':userName,'password':password},
                dataType:"json",
                success:function(data){
                    flag = data.checkResult;
                    if(flag==true){
                       location.href="/user/homepage";
                    }else{
                        location.href="/user/toLogin"
                    }
                }
            });

你可能感兴趣的:(ajax)