<script type="text/javascript"> $(function() { //每行的删除操作注册脚本事件 Receipt $(".btnDel").bind("click", function(){ var vbtnDel=$(this);//得到点击的按钮对象 var vTr=vbtnDel.parents("tr:first");//得到父tr对象; var sn=vTr.attr("data-sn");//取得 sn var title="訂單編號:" + vTr.find(".no").html();//取得 title //警告視窗 swal({ title: '<{$smarty.const._TAD_DEL_CONFIRM_TITLE}>', text: title, type: 'warning', showCancelButton: 1, confirmButtonColor: '#DD6B55', confirmButtonText: '<{$smarty.const._TAD_DEL_CONFIRM_BTN}>', closeOnConfirm: false , allowOutsideClick: true }, function(){ //確定,執行 $.post('<{xoAppUrl}>modules/ugm_cart/order.php', {op:"opDelete",sn:sn}, function(msg){ if(msg==1){ vTr.remove();//刪除 swal("刪除完成!", title, "success"); }else{ swal("刪除失敗!", title, "error"); } }); }); }); //给删除按钮注册js脚本 //每行的删除操作注册脚本事件 $(".btnReceipt").bind("click", function(){ var vbtnDel=$(this);//得到点击的按钮对象 var vTr=vbtnDel.parents("tr:first");//得到父tr对象; var sn=vTr.attr("data-sn");//取得 sn var title="訂單編號:" + vTr.find(".no").html();//取得 title //警告視窗 swal({ title: '確定反沖銷', text: title, type: 'warning', showCancelButton: 1, confirmButtonColor: '#DD6B55', confirmButtonText: '反沖銷', closeOnConfirm: false , allowOutsideClick: true }, function(){ //確定,執行 window.location="<{xoAppUrl}>modules/ugm_cart/order.php?op=cancelReceipt&sn="+sn; }); }); //给删除按钮注册js脚本 }); </script>