1. Click the corresponding code to push it and press it a few times.
("<a href='javascript:void(0)' onclick='digg("&rs("id")&",1)'>Top</a>(<span class='ding"&rs("id")&"'>"&rs("ding")&"</span>)")
("<a href='javascript:void(0)' onclick='digg("&rs("id")&",2)'>Step</a>(<span class='cai"&rs("id")&"'>"&rs("cai")&"</span>)=><a href='?id")&"'>Step</a><br/>")
2. After clicking, call the corresponding JS function ajax and pass in the corresponding parameters. The example code is as follows:
function digg(getid,dingcai){ //Interact with the file in .post. Pay attention to the path $.post('inc/', { "id": getid , "dingcai": dingcai }, function(data){ data=('yang_yes') if(data>=0){ if(dingcai==1){ //Regain the current "top" and add 1 var ding = parseInt($(".ding"+getid).html())+1; //Reupdate the "top" data into the database $(".ding"+getid).html(ding); }else{ //Step var cai = parseInt($(".cai"+getid).html())+1; $(".cai"+getid).html(cai); } alert("Thank you for your support! If you don't need a JS prompt, please delete this line of code"); }else{ alert("You have voted! If you don't need a JS prompt, please delete this line of code"); } }, "text"); }
3. Pass the implementation example code in the specified ASP file such as
mycookies=0 id = clng(("id")) dingcai = ("dingcai") if id<>"" then if ("mycookies"&id)<>id then 'Writecookies,Validity period24Hour ("mycookies"&id)=id ("mycookies"&id).expires=dateadd("H",24,now()) else mycookies=1 end if else mycookies=1 end if 'Accept the corresponding id 'If you step on itidNot empty,And get the top operation or step operation if ("id")<>"" and ("dingcai")<>"" then 'If it's a top operation if dingcai=1 then sql = "update dingcai set ding=ding+1 where update dingcai set cai=cai+1 where yang_yes" else "yang_no" end if end if
This is done, and both the list page and the details page can be implemented similarly.
You can also download this source code to learn
The web page based on jquery's ajax implementation is topped up and touched on the function code, the code has been packaged, you can just look at the code.
This is the article about ASP+ajax implementation code that supports and opposes. For more related ASP, please search for my previous articles or continue to browse the related articles below. I hope you can support me more in the future!