I have added a menu item that calls a function that calls votingapi_set_votes and delete votes. This function works locally fine but when uploaded to the hosting and when i call the function it takes like 5 minutes to update the database with the votingapi_set_votes function.

Menu_item's callback calls a function that contains votingapi_set_votes. Locally: i call the menu item with the node id as parameter and the a vote is added to the node. On Hosting: When i call the menu_item i need to wait five minutes or so to see the node vote updated.

1 Answer 1


I hope this code may work for you Try this code in your theme's js file:

Drupal.behaviors.Your-Theme-Name = {

 attach: function (context, settings) {

//add your class in click function

    jQuery('.view-id-top_users.view-display-id-page .views-field-php .flag-link-toggle').click(function(){

        jQuery(document).ajaxComplete(function() {





  • I am going to try it vikram, i think it's going to take some time to test as i can't upload any thing for a while. However the solution seems legit. Thanks. Apr 27, 2016 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.