我有一个JavaScript函数,用于在aspx页面中的HTML按钮单击事件和在页面代码隐藏中的服务器方法。当用户点击HTML按钮时,它将被处理,并且按钮将显示一个答案。更新按钮标签
如何获得更新的按钮标签,因为它使用的是AJAX?
当我尝试在某处设置更新时,页面不会更新按钮。文本框更新正常工作。从下面的代码可以看出,btnDivide
目前具有“获取天气”的设置值,但我需要在用户完成处理后更改它。
<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>
<br />
<input id="btnDivide" type="button" onclick="return makeCall('gridOne');"
value="Get Weather" />