MathService Add() Method

Listing 3. The proxy class generated by the ScriptManager is used to call the MathService shown in Listing 2. When the service returns data the OnWSAdd() callback method processes the response data.

function Add()
  var x = $get("txtX").value; //Get textbox value for x parameter
  var y = $get("txtY").value; //Get textbox value for y parameter
  //Call service and pass callback method
  XmlForAsp.MathService.Add(x,y,OnWSAdd); }

//Callback method
function OnWSAdd(result)
  $get("spanAddResult").innerHTML = result;