@Jasper_Holton's profile photo

I have made some changes to make the site more secure and easier to use. First of all, I added CSRF forms to the Like, Follow and Cancel buttons so those are more secure now. I also added jQuery to make the like buttons keep you on the same page when you press them, instead of redirecting to a new page. This makes the experience smoother and wasn't too tricky to accomplish. I have posted the code I used below, which simply loops through all of the like form elements on the page, prevents the default (redirect), toggles the button class to change the color, and changes the text/icon. After this, it submits the form without redirecting the page. Try liking a post to see how it works!

@Jasper_Holton, likes this,

Pinterest logo
Tumblr logo VK logo

https://uglek.com/post/253/ -

© Uglek, 2022

Terms of Use and Privacy Policy