87,997
社区成员




function hideBtn(index){
$('.order-status').eq(index).show('fast');
$('.receive-status').eq(index).hide('fast');
$('.btn02').eq(index).hide('fast');
$('.btn01').eq(index).hide('fast');
}
$(function(){
$('.btn02').click(function(){
var index = $('.btn02').index(this);
var orderId = $('.orderId').eq(index).val();
$.ajax({
type: "post", //以post方式与后台沟通
url : "orderAct!cancelOrder.action", //与此Action沟通
data: 'order.orderId='+orderId,
success: function(msg){//如果调用成功
if(msg == "success"){
hideBtn(indx);
alert('订单取消成功!');
}
else{
alert(msg);
}
},
error: function(){
alert("操作不当!");
}
});
});
<span class="order-status"
<c:if test="${order.orderState ne 0 }">
style="display: none;"
</c:if>
>已取消
</span>
<span class="receive-status"
<c:if test="${order.receiveState ne 0 }">
style="display: none;"
</c:if>
>未支付</span>
还有
<button class="btn01"
<c:if test="${order.receiveState ne 0 || order.orderState ne 1 }">
style="display: none;"
</c:if>
>
支付
</button>
<button class="btn02"
<c:if test="${order.receiveState ne 0 || order.orderState ne 1 }">
style="display: none;"
</c:if>
>
取消
</button>