php - Uncaught ReferenceError: function is not defined jQuery, although function is defined -
i'm having issue figuring out why getting following error, though function defined.
uncaught referenceerror: vote_review_function not defined
here 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 response data serv console.log(data); }); return false; } and here 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 of pages works, on other pages error above.
you have syntax error in line var anime_list_entry_id = <?php echo $anime_list_entry_id; ?>; in functions updateepisodeseen , jquery(document).on('click', '.wantedstatus', function(event) { because <?php echo $anime_list_entry_id; ?> not printing causing javascript var anime_list_entry_id = ; throws error in console saying uncaught syntaxerror: unexpected token ;
you need assign default value if said value not present
Comments
Post a Comment