新手问下按键功能怎么实现

yoonayao 2018-04-03 11:12:22
jsp用的template
<button class="btn-small pull-right btn-primary relieve-btn btnpadding padding4" onclick>{{if v.status==1}}立即使用{{else}}立即领取{{/if}}</button>

controller
/**
* 优惠券微网站领取
* @return
*/
@RequestMapping("/couponSendWebReceive")
@ResponseBody
public Result couponSendWebReceive(HttpServletRequest request,QueryCouponSendParam receiveParam){
Result result = Result.successResult();
UserDTO user=(UserDTO)request.getSession().getAttribute(Constants.SESSION_LOGIN);
receiveParam.setUserName(user.getId());
try {
couponSendManagerSerivce.couponSendWebReceive(receiveParam);
LogUtil.insertLog(logtextService, 2, receiveParam.getCustomerId()+"会员领取优惠券", user.getName());
} catch (Exception e) {
result = Result.errorResult("操作失败");
}
return result;
}
新手问下按键功能怎么实现,这是我写的
$(".padding4").click(function() {
$.ajax({
url:ctxAdmin+"/couponSend/couponSendWebReceive",
type:"post",
success:function(data){
if(data.status==0){
data.status=1,
$(".padding4").value="立即使用";
}else{
console.log("111");
}
}
});
});
...全文
399 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Info_Qi 2018-04-08
  • 打赏
  • 举报
回复
jsp 用el表达式,或者写 js判断
yoonayao 2018-04-03
  • 打赏
  • 举报
回复
方法可以了,if判断不行
能源恒观 2018-04-03
  • 打赏
  • 举报
回复
按键功能就是button啊,给个方法就好了

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧