Example code of Ajax Implementation of phpcms thumb up function, ajaxphpcms

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.