Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate Button Label
    primarykey
    data
    text
    <p>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.</p> <p>How do I get the button label to be updated, as it is using AJAX?</p> <p>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, <code>btnDivide</code> has a set value of "Get Weather" at the moment, but I need to change it once the user is done processing.</p> <pre><code>&lt;script type="text/javascript"&gt; &lt;![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 &amp;&amp; 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": ******* &lt;/script&gt; &lt;style type="text/css"&gt; #result { width: 1010px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Ajax TicTacToe&lt;/h1&gt; &lt;p&gt;Major City: &lt;input type="text" id="num1" onclick="return num1_onclick()" /&gt;&lt;/p&gt; &lt;p&gt;Country: &lt;input type="text" id="num2" onclick="return num2_onclick()" /&gt;&lt;/p&gt; &amp;nbsp; &lt;br /&gt; &lt;input id="btnDivide" type="button" onclick="return makeCall('gridOne');" value="Get Weather" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload