AJAX 同步请求的JS

来源:互联网 发布:网络防火墙是什么 编辑:程序博客网 时间:2024/05/18 10:18
<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;}


0 0