[Answered ]-Like button using Ajax not working in Django project

1๐Ÿ‘

โœ…

I found the issue.

I was pointing the Ajax code at "main" as seen in the following snippet:

...
<script type="text/javascript">
$('main').on('click', '.likebutton', function(){
...

My issue was that I forgot to surround the block with the main tag when I ported this project over.

In my base.html I added the following code:

<main role="main" class="container h-100">
    {% block content %}
    {% endblock content %}
</main>

This fixed the issue.

๐Ÿ‘คShyrtle

Leave a comment