不能访问AJAX输入参数在Action类
时间:2023-05-04 01:37:00
$.ajax({
url: "ApplyCouponCode",
type: "POST",
data: {couponCode: $('#PaymentMethod_couponCode').val()},
dataType: "json",
error: function(){
alert('Error');
},
success: function(data){
alert('SUCCESS');
$('#spanValidatedCoupon').text('Is coupon valid? ' data.couponIsValid ' couponAmount = ' data.couponAmount);
}
});
动作类别:
public String applyCouponCode() throws Exception {
if(logger.isDebugEnabled()){
logger.debug("data: couponCode '" couponCode "'");
}
return SUCCESS;
}
Action类方法[applyCouponCode]被调用。couponCode是空的..请指教。 couponCode有公共getter/setter方法..我还需要做什么?