一個計算價格的函數 不指定

Else , 2009/07/20 16:41 , 代码片段,演示也有 , Comments(0) , Reads(538) , Via Original

function countprice()
{
  
  
        $.ajax({
        beforeSend:function(){$("#msg").addClass("msg").html("提交計算");},
        type: "post",
        url:"ajax.aspx?act=count&n="+Math.random(),
        data:$("#CBL_XQ input[type=checkbox]").serialize()+"&Address1_1="+$("#Address1_1").val()+"&Address2_1="+$("#Address2_1").val(),
        success: function(count){
          if(count==0){
            $("#Price").html("價格不能為 0");
            $("#sendinfo").attr("disabled","disabled");
          }
          else
          {
            $("#kd_price").val(count);            
            $("#SumPrice").html("價格:"+count);
            $("#lbl_price").html("稅金:"+Math.ceil(count*0.05));
            $("#Price").html("<br />總金額(含稅):"+Math.ceil(count*1.05));            
            $("#sendinfo").attr("disabled","");
            
            
          }
          
        },
        error:function(){
        
        $("#kd_price").val("");        
        $("#SumPrice").html("");
        $("#lbl_price").html("");
        $("#Price").html("暫不服務");        
        $("#sendinfo").attr("disabled","disabled");
        }  
      });
}
Add a comment

Nickname

Site URI

Email

Enable HTML Enable UBB Enable Emots Hidden Remember [Login] [Register]