根据动态id判断checkBox是否被选中

页面部分:

   
             
                    禁止支付
               
                
                
                    
                      ${status.ordNo}')"/>
                    

                    
                      ${status.ordNo}')"/>
                    

                
              

           

JS部分:

function check1(obj){
  var test = document.getElementById(obj).checked;
  if(test){
   if(confirm("您确定要禁止支付这个订单吗?")){
    $.ajax({
     url:"${pageContext.request.contextPath}/entreOrder_updateNOiPaymentOrder.action",
     type:"post",
     data:{"ordNo":obj,"flag":"1"},
     dataType:"json",
     success:function(data){
      if(data.updateNOiPaymentOrderSUCCESS){
       alert("恭喜:禁止支付成功!");
      }else{
       alert("服务器繁忙,请重试!");
      }
     }
    });
   }
  }else{
   if(confirm("您确定要允许支付这个订单吗?")){
    $.ajax({
     url:"${pageContext.request.contextPath}/entreOrder_updateNOiPaymentOrder.action",
     type:"post",
     data:{"ordNo":obj,"flag":"0"},
     dataType:"json",
     success:function(data){
      if(data.updateNOiPaymentOrderSUCCESS){
       alert("恭喜:允许支付成功!");
      }else{
       alert("服务器繁忙,请重试!");
      }
     }
    });
   }
  }
 }

你可能感兴趣的:(js-jquery,java基础)