Is there a way to implement a simple Heart vote(just +1 vote with counter without ability to vote more than once) using only Javascript / jQuery and HTML5 data attributes, other HTML5 APIs, without any serverside stuff?
Asked
Active
Viewed 98 times
0
-
how would you keep track of the votes without a resource that is accessible by all users (i.e. a server)? – Neil S Aug 23 '13 at 20:57
-
I don't really know how to do that. I'm just learning :| – Coloredbricks Aug 23 '13 at 21:06
-
the question was supposed to be somewhat rhetorical. :) – Neil S Aug 23 '13 at 21:10
3 Answers
2
You can use localStorage
to record that client has voted. Something like this:
localStorage.setItem('voted', true);
To check if client voted before:
var voted = localStorage.get item('voted');
Update:
As you need a counter, you may try one of BAAS (backend-as-a-service) services, such as parse.com or kinvey.com

aadel
- 884
- 8
- 15
-
1That wouldn't work to show the total number of +1 votes because it would be stored locally on the clients. – Tjofras Aug 23 '13 at 21:04
0
You need to store it in some type of database. So if you don't have any server side code that does this you need to find a service that will do it for you. (I don't know if one exists but i wouldn't be surprised if there did).

Tjofras
- 2,116
- 12
- 13