Like Button with page increment

In nominees i have the Like buttons, not sure what you mean? i have uploaded it here:
Maybe you can see something :confused:

.showcase-link is a div container without an href attribute. Where do you want to get the URL from?

Not sure if i need it! What i have to put in the href? So i thought in footer function is all i need:


  $('.showcase-link').on('click', function(e) {
    var url   = $(this).attr('href');


This does not make sense. You are trying to get the url for the ajax call from the href attribute of the showcase-link. But there is no href attribute, so there is no url that can be called by get(). That’s why I said use console.log() to check the results of your calls.

If you don’t want to link to that page, you can use a button as you do, but then you need to use a route that does the increment.

iam really confuse, why i need the attribute and what should be inside the href?
What you mean with use the console.log() ? how i can use it? do i have to set something up?

Honestly, this goes far beyond what Kirby support can do for you. It does not have anything to do with Kirby, but is a Javascript problem. Maybe hire a developer to fix this for you?

Why this has´t to do something with kirby? I try to use one of your plugin for this, that does´t work. So this is my alternative way with your increment function. Just wanna know a way to call this function, otherwise this function brings me nothing.

I agree with @texnixe. This will probably take like a 100 questions before you have something that works.

If you don’t know what console.log in javascript is, it’s totally fine, but it’s also the very basic of javascript and you should probably start learning the basics first. An alternative can be to get someone to help you with writing the code.

I was also there in the beginning. We all have been there. I also asked 100 questions, well I still ask questions, but now I try to narrow it down to a minimum so that it is a really small question.

Big topics like this, especially when inexperienced, can easily start a chain of questions that almost never stops.

If you still want to ask javascript questions is a great forum for that. But be aware, they can be really rude if your question(s) does not make sense.

Good luck! :slight_smile:


And there is one other reason: If you don’t know what you are doing, you are risking to run into security issues. This is probably not as important if you are working on a private project where it does not matter, but for a client project, it would.

where can i read about this function:

if(r::ajax()) {

This is not very much documented, by all it does is check if the request is an Ajax request. It’s the same as

for example, if you’d just put this code into your template:


the page would be updated on every page reload, instead of in reaction to an Ajax request.

If you still want this and have not succeeded yet this could be a solution as well:

Add a Like button widget to your website with just a few lines of HTML-code!

1 Like

thank you very much. I will look into it :slight_smile:

I’m considering to use like/dislike buttons instead of stars on one of my websites. Therefor I’ve started with a test:

  • Click to like or dislike.
  • Click again to remove the like or dislike.

There are no ajax or even Kirby implementations in this test, pure html/css/js.

Maybe this will end up as a Kirby plugin in the future. Feel free to use the code if you want.

1 Like

Looks nice. How i can use the code?

All the code is here:

Using it with a Kirby site without basic knowledge would probably be a 100+ step tutorial. But at least, there it is, the frontend part of it (as it contains no backend/saving/antispam etc).

Anyway, in your case, might be better. They have a free plan as well. Or you need to wait until I’ve built a plugin around it, if that will happend.

Just one question to your solution, where do you store the likes?

If you read carefully, the likes are not perpetuated in this example:

It would be great to create this plugin.
Im trying to create same thing.

I’m already can create posts (reviews) with ratings, and cons/pros but im stuck on like/dislike function.

I’m working on it from time to time. I think it’s like a light version of my I’ve got a head start by using many things I’ve learned by creating Kirby Ratings.

If I have the time for it I will probably release it the next week.