前端:
function login(){
debugger;
var username = $("#username").val();
var pwd = $("#pwd").val();
console.log(username+"%%%"+pwd);
var data = {
username: username,
pwd: pwd,
type:'1'
};
mui.ajax(
'http://192.168.1.120:8080/wjcs/sys/login/loginApp.do',{
data: data,
dataType:'json',//服务器返回json格式数据
type:'post',//HTTP请求类型
timeout:10000,//超时时间设置为10秒;
headers:{'Content-Type':'application/json'},
success:function(data){
//服务器返回响应,根据响应结果,分析是否登录成功;
debugger;
},
error:function(xhr,type,errorThrown){
//异常处理;
console.log(type);
}
});
}
后台:
@RequestMapping(value = "/loginApp", method = RequestMethod.POST)
@ResponseBody
public Msg login(@RequestParam String username, @RequestParam String pwd, @RequestParam String type, HttpServletRequest request) {
boolean rememberMe = false;
System.out.println("username----->"+username+"&pwd----->"+pwd);
}
打印后台参数全部为null~~~~
然后的然
orz,卡了我半天了,终于出坑了
2017-05-12 15:03