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.