function setaddress(code,id){ var text=$("#"+id).attr("msg"); var nextSelect=$("#"+id).next("select[name='adrid[]']"); nextSelect.html(''); $.post("/index.php/cn/Public/setaddr.html",{code:code,text:text},function(res){ //$("#"+id).attr("disabled",false); $("#"+id).html(res); },'text'); } $(function(){ $("span.support").click(function(){ ajaxSupport(this,$(this).attr('data-id'),'support'); }); $("span.support_reply").click(function(){ ajaxSupport(this,$(this).attr('data-id'),'support_reply'); }); $("span.oppose_reply").click(function(){ ajaxSupport(this,$(this).attr('data-id'),'oppose_reply'); }); }); function ajaxSupport(obj,id,act){ $.post("/index.php/cn/Public/setaddr.html",{action:act,id:id},function(res){ if(res=='loginNULL'){alert('亲,请您登录在进行相关操作');return false;} if(act=='support' || act=='support_reply' ){var msg='顶'}else{var msg='踩'} if(res=='timeNULL'){alert('亲,您已'+msg+'过了,请休息一下吧^_^');return false;} $(obj).html(res); $(obj).removeClass(act); },'text'); }