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

  • Home
  • SEARCH
  • 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 3499434
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:36:40+00:00 2026-05-18T12:36:40+00:00

Before I perform some json and disable a button, I simply want to enable

  • 0

Before I perform some json and disable a button, I simply want to enable other buttons that may have been previously disabled. I think it’s related to callbacks which I apparently still don’t get. In the code below, the clicked button does not become disabled prior to running the getJSON.

$(".btnUseProduct").live("click", function(e) {

    var clickedId = $(this).attr('id');
    var provisioning_id = clickedId.split("^")[0];
    var entity_id = clickedId.split("^")[1];
    var entity = clickedId.split("^")[2];

    showUseButtons(function(){        

               $(this).attr({'disabled':'disabled','value':'Used'}); //doesn't work
               $.getJSON("/chinabuy-new/cfcs/services.cfc?method=update_provisioning&returnformat=json&queryformat=column",{"provisioning_id":provisioning_id,"entity_id":entity_id},function(res,code){                        
               });
        });
    e.preventDefault();
});

function showUseButtons() {
    $(".btnUseProduct").each(function(e) {
        $(this).attr({'disabled':'disabled','value':'Used'});
    });
}       
  • 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-18T12:36:40+00:00Added an answer on May 18, 2026 at 12:36 pm

    A callback is a function you pass to another function. That other function you pass it to must call it – otherwise it’s useless.

    function someFunctionThatCallsBack(someCallbackFunction) {
      // do something
      someCallbackFunction(); // calls the callback function
    }
    

    Above, you are passing a function to showUseButtons – but that function just ignores it. It won’t be called so whatever you put in there won’t do anything.

    Perhaps you meant something like the following?

    function showUseButtons(callback) {
        $(".btnUseProduct").each(function(e) {
            $(this).attr({disabled: true, value:'Used'});
        });
        callback();
    }       
    

    Further, inside a function the context changes (i.e. the value of this is different). So you’ll need to alter your code somewhat as well:

        var _this = this; // save the context - the clicked DOM element
        showUseButtons(function(){        
               $(_this).attr({disabled:true, value:'Used'}); //doesn't work
               $.getJSON("/chinabuy-new/cfcs/services.cfc?method=update_provisioning&returnformat=json&queryformat=column",{"provisioning_id":provisioning_id,"entity_id":entity_id},function(res,code){                        
               });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Linq-to-SQL class, and I'd like to perform some pre-save validation before
I want to use this function applicationWillResignActive perform some tasks. before the application shuts
I am writing a small app that has to perform some 'sanity checks' before
I have a Swing application that uses a Java Thread to constantly perform some
We implement some triggers which perform some operations with insert data before committing them
I am using the following code to perform some manipulations on the image that
I need perform some extra logic on an object before it is saved to
I have a registration page and would like to perform some validation (in addition
I have found some sample code on codeproject that allows for user impersonation. This
Before you answer this I have never developed anything popular enough to attain high

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.