• getJson


          		$.getJSON("<%=basePath%>delivery/auditing.do",{Phones:Phones,currPage:currPage,timstamp:timstamp},
    	           			 function(data){
    	           			 	alert(data);					
    							if(data==1){
    							  alert("设置成功");
    							  window.location.href="<%=basePath%>delivery/expressinfo.do?currPage="+currPage;
    							  
    							}else if(data==2){
    							  alert("请先增加计费信息!");
    							  window.location.href="<%=basePath%>delivery/expressinfo.do?currPage="+currPage;
    							}else {
    							  alert("设置失败");
    							  window.location.href="<%=basePath%>delivery/expressinfo.do?currPage="+currPage;
    							}
    		            });
    

      在 .getJSON 中,可以 传递 Phones 这个参数,在java servlet 接口中接收参数。 根据逻辑做处理,通过  pw.print(2)  返回不同的 data 值:

        

    	@RequestMapping(value="/delivery/auditingSuccess.do")			
    	public void auditingSuccess(HttpServletRequest request,HttpServletResponse response) throws Exception{
    	    response.setContentType("text/html");
    	    request.setCharacterEncoding("utf-8");
    	    response.setCharacterEncoding("utf-8");
    
    	    String Phones =request.getParameter("Phones");
    	    String currPage=request.getParameter("currPage");
    
    	    ……
    		
    	    if (null == expressPrice)
    	    {
    		PrintWriter pw = response.getWriter();
    		pw.print(2);
    		pw.flush();
    		pw.close();
    		return ;
    	     }
    		
    	    else if(i == ids.length ){
    		PrintWriter pw = response.getWriter();
    		pw.print(1);
    		pw.flush();
    		pw.close();
    	    }
    	}
    

      

  • 相关阅读:
    JZOJ 4043. 【雅礼集训2015Kzf】洪水
    JZOJ 5451.Genocide
    P4719 【模板】"动态 DP"&动态树分治
    [NOIP2018 提高组] 保卫王国
    【NOIP2017提高组正式赛】列队
    vuex的总结
    height:100vh
    从URL输入到页面展现到底发生什么
    JS的空数组是true还是false(内附JS类型转换表)
    Vue拼图验证组件使用教程
  • 原文地址:https://www.cnblogs.com/z360519549/p/5840883.html
Copyright © 2020-2023  润新知