$(document).ready(function(){ $.ajax({ type:"post", url:conf.rp+‘/loot.action‘, dataType:"json", data:{ userId:"userId", redEnvelopeActivityId:"0905" }, success:function(data){ console.log(data); var fullcont="<div>"; fullcont+=data.body.result.describe+"</div><div><span class=‘money‘>" fullcont+=data.body.result.redContent+"</span></div><div id=‘check_red‘>" fullcont+="查看我的红包</div><div><input type=‘button‘ class=‘coll‘ value=‘立刻领取‘></div>" $("#redcontent").html(""); $("#redcontent").append(fullcont); a.check(); }, error:function(data){ console.log("XXX")} } ) }) var a={ check:function(){ $("#check_red").click(function(){ window.location.href=conf.rp+"/wap/redPacket/jsp/myRed_ticket.jsp"; }) } }
比较奇怪的问题,a.check();在代码最底端调用不起作用,放在success里才能起作用 ,待探究
时间: 2024-11-02 22:39:30