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?

有帮助吗?

解决方案

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

其他提示

No, there isn't. You need a server to store all the responses.

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).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top