How to use ajax to implement likes

Source: Internet
Author: User
How to use ajax to implement likes in php + mysql is very simple. every time you click likes, input the field (cont_id, cont_type) and add 1 to like_count in the database each time, but how can we use ajax in jquery to implement it?


Reply to discussion (solution)

$. Ajax ({type: "get", url: "xxxxxxxxxxxxxx. php ", data: {action:" dianzan ", // php identifies ajax signs (this one does not have to be added. check the php file structure uid:" xxxxxxxxxxx ", // who initiated likes, pid: "xxxxxxxxx", // what elements are likes}, success: function (msg) {// receives the information returned by PHP, whether the likes are successful, if yes, the foreground JS will convert the special effects to remind the user of successful thumb ups. if not, the reason will be prompted }});

We recommend that you directly view the video tutorial.
Http://www.php100.com/html/shipinjiaocheng/PHP100shipinjiaocheng/2011/0417/7924.html

I saw the meeting

Both the upstairs are good people.

Did the landlord make it? Can you give me specific code reference?

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.