AJAX 同步请求的JS

2017-01-13 11:32:50来源:CSDN作者:YangMing_number人点击

<script type="text/javascript">			function cbxxsubmit(){					var fileItem = $('.fileitem > a');					if(fileItem.length > 0){						var uploadHisType = document.getElementById("uploadHisType").value;						if(uploadHisType==0){							var checkboolean = true;							var year = $("#dataYear").find("option:selected").text();							var month = $("#dataMonth").find("option:selected").text();							 $.ajax({								    type:"POST",								    async:false,								    url:"validhave.action",								    data:{year: year, month: month},								    success:function(msg){									    if(msg=="no"){   									    	alert_modal("该年月已上传数据不允许重复上传!", "");											checkboolean = false;									    }								    }							});							if(!checkboolean){								return;							}						}						 confirm_modal('#save', '', true);					}else{						alert_modal("请上传保费结构及赔付率情况统计表!", "");					}			}		</script>

action代码:

public String validhave(){		PrintWriter pw = null;		try {			pw = response.getWriter();		} catch (IOException e1) {			e1.printStackTrace();		}		String year = request.getParameter("year");		String month = request.getParameter("month");		Calendar now = Calendar.getInstance();  		CxywfxCheckFormQuery query = cxywfxCheckFormService.createQuery();		query.tableType(TABLE_TYPE);		query.createUsername(loginedUser().getUser().getUsername());		if(year!=null&&!"".equals(year)&&month!=null&&!"".equals(month)){			query.dataYear(year);			query.dataMonth(month);		}else{			if(now.get(Calendar.MONTH)+1!=1){				query.dataYear(String.valueOf(now.get(Calendar.YEAR)));				query.dataMonth(String.valueOf(now.get(Calendar.MONTH)));			}else{				query.dataYear(String.valueOf(now.get(Calendar.YEAR)-1));				query.dataMonth("12");			}		}		Integer [] statu = {0,1};		query.checkNumbers(statu);		List<CxywfxCheckForm> cxyw = query.list();		if(cxyw.size()>0){//判断该时间段是否已存在			pw.write("no");			return null;		}		return null;	}


最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台