$(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=""; fullcont+=data.body.result.describe+"" fullcont+=data.body.result.redContent+"" fullcont+="查看我的红包" $("#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里才能起作用 ,待探究