I'm having an issue figuring out exactly why I am getting the following error, even though the function is defined.
Uncaught ReferenceError: vote_review_function is not defined
Here is my jQuery code
function vote_review_function(review_id, vote_text) {
user_id = <?php echo $current_user->ID; ?>;
jQuery.post("/wp-content/themes/sahifa/custom_functions/vote_reviews.php", {firstParam : review_id, secondParam : vote_text, thirdParam : user_id}, function(data) {
//this is your response data from serv
console.log(data);
});
return false;
}
and here is my HTML
<a href="javascript:void(0)" onclick="vote_review_function('<?php the_ID(); ?>', 'Yes');" class="vote_link">Yes</a>
<a href="javascript:void(0)" onclick="vote_review_function('<?php the_ID(); ?>', 'No');" class="vote_link">No</a>
On some of the pages this works, but on most other pages I get that error above.
You have a syntax error in the line var anime_list_entry_id = <?php echo $anime_list_entry_id; ?>;
in functions updateEpisodeSeen
and jQuery(document).on('click', '.wantedStatus', function(event) {
because <?php echo $anime_list_entry_id; ?>
is not printing anything causing the javascript var anime_list_entry_id = ;
which throws an error in the console saying Uncaught SyntaxError: Unexpected token ;
you need to assign a default value if the said value is not present