php ajax.$post realizes the functions of saving, liking and disliking_PHP tutorial
WBOYOriginal
2016-07-13 10:44:19917browse
The save, like, and dislike functions are mainly used in comments. Here we will make a simple mysql implementation based on jquery ajax and php. The source code download is attached at the end of the article.
php is used more and more widely, and in order to increase the richness of the website, many new technologies have emerged. Ajax is an indispensable technology in modern websites. It can refresh data asynchronously and achieve many effects, such as refreshing verification codes and the saving function in Weibo, all using this.
INSERT INTO `finger_ajax` VALUES ('1', '今天天气还不错哦!去做点什么好呢?', '10');
INSERT INTO `finger_ajax` VALUES ('2', '欢迎来到 www.bKjia.c0m,国庆将至,祝大家国庆节快乐!!', '3');
function(data){
if(data=="ok"){
alert("Thank you for your support!");
}else{
alert("Sorry, failed!"); } }, "text"); //Get the current number of "save" and add 1 var finger = parseInt($(".finger"+topic_id).html())+1; //Update the number of "save" times $(".finger"+topic_id).html(finger);
}
Database code (finger_ajax.sql):
The code is as follows
Copy code
DROP TABLE IF EXISTS `finger_ajax`;
CREATE TABLE `finger_ajax` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL DEFAULT '',
`finger` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-------------------------------
-- Records of finger_ajax
----------------------------------
INSERT INTO `finger_ajax` VALUES ('1', 'The weather is not bad today! What should we do?', '10');
INSERT INTO `finger_ajax` VALUES ('2', 'Welcome to www.bKjia.c0m, the National Day is approaching, I wish everyone a happy National Day!!', '3');
Original address: php ajax implements the functions of save, like and dislike http://file.bKjia.c0m/upload/2013/12/a63.zip
http://www.bkjia.com/PHPjc/633118.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/633118.htmlTechArticleThe save, like and dislike functions are mainly used in comments. Here we will make a simple mysql based on jquery ajax and php. To implement the save, like, and dislike functions, the source code download is attached at the end of the article. There are more and more php applications...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn