1,页面调用ajax
new Ajax.Request('${ctx}/customer/card/creat-card-verifycode', { method: 'get', parameters: { contactId: cardHoldId }, onComplete: function(dispatcher) { //TODO 分析ajax返回值 } });
?
2,后台实现ajax
private List<String> virifyCodeList = new ArrayList<String>(); public String ajax(){ virifyCodeList.add(String); return "j:virifyCodeList"; }
?
3,前台获取值,分析
onComplete: function(dispatcher) { var virifyCodeList = dispatcher.responseText.evalJSON(); $("verifyCode").value=virifyCodeList[0]; }
?
?