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 6795873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:23:56+00:00 2026-05-26T18:23:56+00:00

function pageLoad() { $(.VoteUp).live(click, function () { var Id = $(this).attr(index); d = JSON.stringify({

  • 0
function pageLoad() {


        $(".VoteUp").live("click", function () {
            var Id = $(this).attr("index");
            d = JSON.stringify({ "Id": Id })
            $.ajax({
                type: 'POST',
                url: '../API/Services.asmx/LikeId',
                data: d,
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                success: testFunc,
                error: errFunc
            });

            $(".VoteUp").each(function () {
                $(this).attr("disabled", "disabled");
            });

        });

        function testFunc(result, userContext, methodName) {
            if (result.d[0] == "true") {
                TheVoteUpControl.val("added");
            }
            else {
                TheVoteUpControl.val("deleted");
            }
            $(".VoteUp").each(function () {
                $(this).removeAttr("disabled");
            });

        }
        function errFunc() {
            alert('error');
        }

How can I change the value of that same .VoteUp control on success? I can’t seem to figure out how to target that same control who initiated the event. $(“.VoteUp”)

Suggestions?

  • 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-26T18:23:56+00:00Added an answer on May 26, 2026 at 6:23 pm

    the only way i can think of is cache the element in the global variable and catch it in the success callback. also i have moved the enabling and disabling of the $(".VoteUp") in the complete and beforeSend callbacks respectively

        $(".VoteUp").live("click", function (e) { 
            e.preventDefault();
            $this=$(this); <-- cache this in the global variable
            var Id = $(this).attr("index");
            d = JSON.stringify({ "Id": Id })
            $.ajax({
                beforeSend:function(){
                  $(".VoteUp").attr("disabled", "disabled");
                },
                type: 'POST',
                url: '../API/Services.asmx/LikeId',
                data: d,
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                success: testFunc,
                error: errFunc
                complete:function(){
                      $(".VoteUp").removeAttr("disabled");
               }
            });
        });
    
    
        function testFunc(result, userContext, methodName) {
            if (result.d[0] == "true") {
                $this.val("added");
            }
            else {
                $this.val("deleted");
            }
    
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please, look at this jquery code : $(#ImageButton1).click(function () { var url = Goods.aspx?key=
<script type=text/javascript> function pageLoad() { var $scrollingDiv = $(#scrollfix); $(window).scroll(function () { if ($(window).scrollTop()
I'm using this code: <script type='text/javascript'> $(document).ready(function () { //Check if url hash value
function pageLoad() { clearTimeout(MessagesTimer); clearTimeout(NotificationsTimer); var MessagesTimer = setTimeout(CheckMessages(), 15000); var NotificationsTimer = setTimeout(CheckNotifications(),
Does jquery support both function pageload() and $().ready() ? Or is pageload() for ajax.net
in the clientside pageLoad() function im trying to get the multiview active index and
I have the following in an ASP.NET 2.0 page. <script type=text/javascript> function pageLoad() {
i have many events such as $('.hidefile').click(function (event) { On page load and on
function Obj1(param) { this.test1 = param || 1; } function Obj2(param, par) { this.test2
i have 3 usercontrols who in each i used pageLoad function in javascript and

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.