If you go to the website here and attempt to click on the voting arrows, you'll encounter the issue I'm facing. Contrasting this with the homepage where clicking on the logo allows you to vote. The arrows change their appearance based on the vote, with the help of the in_array()
function which determines the user's vote and displays the corresponding icon correctly. Everything works smoothly on the linked submission page. However, when trying to click on the links, it always defaults to the else statement in the Javascript function provided below:
I am only presenting the function for liking as I'm encountering a similar problem with disliking.
function getVote(filename, num, idnum, user)
{
var like = document.getElementById('like_arrow' + num);
var dislike = document.getElementById('dislike_arrow' + num);
if (like.src.indexOf('../vote_triangle.png')!=-1 && dislike.src.indexOf('../vote_triangle_flip.png')!=-1) {
like.src = '../vote_triangle_like.png';
(AJAX to alter rating here)
} else if (like.src.indexOf('../vote_triangle.png') != -1) {
like.src = '../vote_triangle_like.png';
dislike.src = '../vote_triangle_flip.png';
(AJAX to alter rating here)
} else {
like.src = '../vote_triangle.png'; // Always defaults to this
(AJAX to alter rating here)
}
}
In case you're curious, the num
variable is used on the front page to differentiate between submissions by incrementing each time. In this case, I have left that value blank in the function so it shouldn't be causing any issues. It could potentially be my problem, but I am unable to identify how.
Thank you!