典型的Jquery Ajax请求示例
$.ajax({url: contextPath+"/user/login",cache: false,type: "POST",data: $('#form1').serialize(),dataType: "json",beforeSend: function(){return checkLogin($("#u").val(), $("#p").val());},success: function(ret){if(ret.status == '1'){window.location.replace(contextPath + "/main/index");} else {errorMsg("登录失败",ret.statusInfo)}},error: function(){errorMsg("登录失败","服务器异常,请稍后再试");}});
页:
[1]