<span class="f_right"><a href="javascript:void(0);" class="hulve" tags="<%=123 %>">忽略</a></span>
通过class绑定
$(".hulve").click(function(){ //alert($(this).attr("tags")); var html =$(this).parent(); var id = $(this).attr("tags"); if (id != "") { $.post("/userinfo/IgnoreNotic", { '_id': id}, function(data) { if (data.success || data.success=='true') { html.html("已忽略"); } else { alert(data.msg); }}, "json") } });
<a href="javascript:void(0)" id="btnSend" class="use_btn_ f_left"><span class="a-1"></span><span class="a-2">Test</span><span class="a-3"></span></a>
$("#btnSend").bind("click",function(){ var content = $("#content1").val(); var refID= 178; var groupID=18; var rID= 0; $.post("/group/TopicCreate", { 'pID': refID,'content':content,'gid':groupID,'rID':rID}, function(data) { if (data.success) { window.location.href='/topic/178'; } else { alert(data.msg); }}, "json"); });
通过ID绑定