JS Button

Website URL

(please specify the URL of the site on which you are experiencing the problem)

Error Message

  1. GET [link to the index page] 500 (Internal Server Error)
  2. GET https://errors.infinityfree.net/errors/404/ 404

Other Information

So, im creating a website where you can post text, create accounts and so on. It works well untill I’m going to press the “like-btn”, which should work together with a JS file, and give the post a like. Earlier websites i’ve worked on havn’t been able to connect to the JS Files, i dont know if im doing anything wrong. Any help is appricated.

PS: I’m not sure if the error messages have anything to do with the error im experiencing.

checking…

I cannot see the like button on your site, please supply the url that is having the issue or the source code

thanks.

2 Likes

http://bases.epizy.com/index.php

You should be able to see it now.

FYI, it works when I have it on my localhost.

What like button do you mean exactly? I don’t see any like button on that page, and the heart with a 1 one next to it is not clickable.

I do see that the response code of your page is 500, which makes me suspect that your PHP code crashed halfway down the page. Maybe that’s preventing the like button from being added.

2 Likes

Thank you! The problem was as you said, I used str_contains, but since that was introduced in PHP 8 I couldn’t use that. I found a way around the str_contains by using strpos, and then the PHP could continue on. Since the like btn, with the heart, was using JS, and that is executed in the end, it wasnt executed.

Now it works, thanks again!

1 Like

Based on the error messages you supplied, it appears that there is a problem with the server that hosts your website. The 500 Internal Server Error message indicates an issue with the server’s configuration or programming, whereas the 404 error message indicates that the requested resource could not be located.

However, without further information about your website and the code you’re using, it’s tough to say for certain. If you’re experiencing problems connecting to your JavaScript file, double-check that it’s in the right directory and that the path to the file is correct. You should also ensure that the file is properly linked in your HTML code.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.