5
A
回答
6
有很多腳本out there但是這並不難。
我已經使用過jQuery(處理AJAX)和一個小的PHP腳本。例如,一些僞代碼:
// Some checking for recent votes from this user is appropriate here
if (isset($_POST['voteType'], $_POST['postId']) && $user->loggedIn) {
// insert vote into database if not already inserted
echo json_encode(array('error' => false));
} else {
// bad request/hack attempt
echo json_encode(array('error' => true, 'message' => 'Bad parameters sent'));
}
,然後一些jQuery的:
$('#upVote').click(function() {
$.post('vote.php', {voteType: 'up', postId: 42}, 'updateIcon(data, textStatus)', 'json');
});
function updateIcon(data, textStatus) {
// If error = false highlight the upvote icon
// else show the error message returned
}
0
相關問題
- 1. Reddit式投票系統,我如何避免重複投票?
- 2. AJAX + PHP投票系統
- 3. Reddit投票API
- 4. Javascript投票服務器。這會導致堆棧溢出嗎?
- 5. php-mysql投票系統?
- 6. 投票系統java
- 7. .NET堆棧溢出?
- 8. 堆棧溢出
- 9. jQuery投票系統
- 10. Java投票系統
- 11. 如何投票投票系統?
- 12. Laravel 5.3+ Vue類似Reddit的投票系統
- 13. 投票系統在ASP.NET MVC
- 14. 在jQuery中堆棧溢出風格標記系統
- 15. 如何在堆棧溢出或Quora上創建標記系統
- 16. 的MySQL/PHP邏輯「投票」系統
- 17. 計算投票 - PHP和MySQL投票系統
- 18. jQuery,PHP和Smarty的投票系統
- 19. 投票系統在PHP和MySQL的狀態投票,像總統選舉
- 20. Lua堆棧溢出
- 21. C++堆棧溢出
- 22. Threading.Timer堆棧溢出
- 23. 堆棧溢出C++
- 24. C#堆棧溢出
- 25. MPMoviePlayerController堆棧溢出
- 26. Malloc堆棧溢出
- 27. 帶有會話的PHP投票系統?
- 28. php投票系統 - 數據庫問題
- 29. Reddit式的投票按鈕
- 30. 堆棧溢出我猜insmod