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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:33:37+00:00 2026-05-27T09:33:37+00:00

I have a JavaScript function for a HTML button click event in aspx page

  • 0

I have a JavaScript function for a HTML button click event in aspx page and a server method in the page code-behind. When the HTML button is clicked by the user it will be processed, and the button will display an answer.

How do I get the button label to be updated, as it is using AJAX?

When I try to set the update somewhere, the page does not update the button. The text box updates work fine. As one can see from the code below, btnDivide has a set value of “Get Weather” at the moment, but I need to change it once the user is done processing.

<script type="text/javascript">
<![CDATA[

// This function creates an asynchronous call to the service
function makeCall(operation){
    var n1 = document.getElementById("num1").value;
    var n2 = document.getElementById("num2").value;


    // If user filled out these fields, call the service
    if(n1 && n2){

        // Instantiate a service proxy
        var proxy = new Service();

        // Call correct operation on vf cproxy       
        switch(operation){

            case "gridOne":
proxy.Calculate(AjaxService.Operation.getWeather,n1,n2,    
onSuccess, onFail, null);
                btnDivide.value = "TestNewValue";

                break;
            case "gridTwo":
*******
</script>

<style type="text/css">
    #result
    {
        width: 1010px;
    }
 </style>

</head>
<body>
<h1>Ajax TicTacToe</h1>
<p>Major City: <input type="text" id="num1" onclick="return 
num1_onclick()" /></p>
<p>Country: <input type="text" id="num2" onclick="return num2_onclick()"
 /></p> 
&nbsp;
<br />
<input id="btnDivide" type="button" onclick="return makeCall('gridOne');" 
    value="Get Weather" />
  • 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-27T09:33:38+00:00Added an answer on May 27, 2026 at 9:33 am
     function onSuccess(mathResult){
        document.getElementById("result").value = mathResult;
        document.getElementById("btnDivide").value = "test";
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Javascript code add_num = { f: function(html, num) { alert(this.page);
I have this code: <script language=javascript> $(function() { $('#items,#button-search').hide(); $(#companies).click(function() { $(this).attr(value,); $('#address,#new-company-form').empty(); });
I have some JavaScript code in an HTML page with a button. I have
I have this function in my Javascript Code that updates html fields with their
I have assigned a click event to a button, which retrieves a different HTML
I have an aspx page defined as follows: <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script
I have a javascript function (function1) that checks some global variables (can the user
I have some javascript that ends up programatically clicking on a button: document.getElementById(myButton).click(); This
In the master page I have the following code: <!DOCTYPE html> <html> <head> <meta
I have a problem with button event in web user control First i have

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.