Example code of Ajax Implementation of phpcms thumb up function, ajaxphpcms
The first step is to remove the remaining one from the background module ---> News mood ---> mood configuration. Change the name to "like" and submit and save the configuration.
The second is to modify the news mood template file:/phpcms/templates/default/mood/index.html
Delete all codes and only return the total number of likes.
{loop $setting $k $v} {$data[$v['fields']]} {/loop}
The implementation of the template page is as follows:
<Div class = "info"> <a href =" http://phpcms.com/content-150-1-1.html "Target =" _ blank "title =" crowded on-site Exhibition ">
Ajax processing K = 8 is like
$(".zanbtn").on("click",function(){ var id = $(this).next().attr("title"); var aval = $(this).next("a").html(); $.getJSON('http://phpcms.com/index.php?m=mood&c=index&a=post&id=150-'+id+'-1&k=8&'+Math.random()+'&callback=?', function(data){ if(data.status==1) { console.log( $(this).next()); $("#zans"+id).html(data.data); }else { alert(data.data); return false; } }) });
The above is the example code of Ajax Implementation of phpcms thumb up function introduced by xiaobian. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!