Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3217732
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:26:44+00:00 2026-05-17T15:26:44+00:00

function manageVoting() { $(div.votemaincontainer).each(function () { // variable Declaration and intialization. var myRating =

  • 0
function manageVoting() {
    $("div.votemaincontainer").each(function () {
        // variable Declaration and intialization.
        var myRating = parseInt($(this).find('#[id$=hfMyVote]').val());
        var currentVote = parseInt($(this).find('#[id$=hfCurrentVote]').val());
        $('.VoteDownImage').live(click, function () {
            ajaxcall(0);
        });
        $('.voteupImage').live(click, function () {
            ajaxcall(1);
        });
    }

    function ajaxcall(a){ // here it's giving error.
        var questionID = parseInt($(this).find('#[id$=currentquestionId]').val());
        var objectType = 100;
        var previousvote = 2;
        $.ajax({
            url: 'UserControls/Vote/VoteAction.aspx/Voting',
            cache: false,
            type: 'POST',
            data: '{ObjectType: "' + objectType + '", guid: "' + currentGuid + '",previousVote: "' + previousvote + '",vote:"' + a + '"}',
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            success: function (data) {
                var result = eval(data.d);
            }
        });
    }
    $(function () {
        //    manageVoting();
    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:26:44+00:00Added an answer on May 17, 2026 at 3:26 pm

    EDIT: After improving the code indentation in your question, it appears as though you forgot to close the .each() loop with }); before the closing bracket for the manageVoting() function.

    Proper code indentation is extremely helpful.

    Also, it doesn’t make too much sense to apply .live() in a loop. You only need to do that once.

    Here’s your code with the improvements:

      // Call these once on page load.
      // Note the difference in capitalization in your selectors. Make sure it is
      //    the same in your HTML classes
    $('.VoteDownImage').live(click, function () {
        ajaxcall(0);
    });
    $('.voteupImage').live(click, function () {
        ajaxcall(1);
    });
    
    function manageVoting() {
        $("div.votemaincontainer").each(function () {
            // variable Declaration and intialization.
            var myRating = parseInt($(this).find('#[id$=hfMyVote]').val());
            var currentVote = parseInt($(this).find('#[id$=hfCurrentVote]').val());
        });  // closed the .each() loop
    }
    
    function ajaxcall(a){ // here it's giving error.
        var questionID = parseInt($(this).find('#[id$=currentquestionId]').val());
        var objectType = 100;
        var previousvote = 2;
        $.ajax({
            url: 'UserControls/Vote/VoteAction.aspx/Voting',
            cache: false,
            type: 'POST',
            data: '{ObjectType: "' + objectType + '", guid: "' + currentGuid + '",previousVote: "' + previousvote + '",vote:"' + a + '"}',
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            success: function (data) {
                var result = eval(data.d);
            }
        });
    }
    $(function () {
        //    manageVoting();
    });
    

    Original answer:

    You don’t specify a type for function parameters (or any other variables) in javascript. This is because of loose typing, where any variable can be used to store any type.

    This line:

    function ajaxcall(int a) 
    

    should be:

    function ajaxcall(a) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function DeleteData(ID) { var ctrlId=ID.id; var divcontents=document.getElementById(ctrlId).innerHTML; var tabid=ctrlId.replace(/div/,'tab'); var tabcontents=document.getElementById(tabid).innerHTML; alert(document.getElementById(tabid).innerHTML); document.getElementById(tabid).innerHTML=<TBody><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr></TBody>; document.getElementById(ctrlId).innerHTML='';
function appendRefToLinks(ref){ alert(hi); $j('a').each(function(i){ alert('hello'); $j(this).attr('href',$j(this).attr('href') + ?ref= + $j.cookie.get(tb_ref)); }); } I see
function main() { Hello(); } function Hello() { // How do you find out
function register_contact ($person = array()) { $nogood = false; foreach ($person as $val) {
function Obj1(param) { this.test1 = param || 1; } function Obj2(param, par) { this.test2
function json (url){ $.getJSON(url, function(data) { return data; }) } this function don't see
function safe(){ if($(this).is(':checked')){ $(select[name='sort']).attr(disabled, disabled); $(input[name='group']).attr(disabled, disabled) } else { $(select[name='sort']).attr(disabled, false); $(input[name='group']).attr(disabled, false)
I have found this example on StackOverflow: var people = new List<Person> { new
function returnsAnArray () { return array ('test'); } echo returnsAnArray ()[0]; generates a syntax
Function FillAdminAccount() As Boolean FillAdminAccount = True Try SQLconn.ConnectionString = connect timeout=9999999; & _

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.