下面是我想在http://geheimprojekt.nomachines.org/上完成的任务
这是我第一次尝试使用AJAX。我有jQuery的知识,但我似乎不能把这些点联系起来。
SQL
CREATE TABLE IF NOT EXISTS `sggcount` (
`counter` bigint(20) NOT NULL DEFAULT '2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci;
--
-- Dumping data for table `sggcount`
--
INSERT INTO `sggcount` (`counter`) VALUES
(2);发布于 2012-04-20 11:58:47
使用jQuery,您可以将单击事件绑定到按钮并发出ajax请求。
在服务器端,PHP页面应该更新SQL数据。遵循Javascript演示代码
$(document).ready(function(){
$('button-selector').click(function(){
//use jquery ajax call to call php server page that update SQL data
$.ajax({
url: "updateClick.php",
context: document.body
}).success(function() {
//success callback
});
});
});https://stackoverflow.com/questions/10245693
复制相似问题