Using JavaScript Web Service Proxy

Listing 2. This code demonstrates how to use the JavaScript Web service proxy generated by the ScriptManager to call a Web service. The Address object exposed through the Address property of the CustomerDetails class is directly accessible.

function btnClick()
{
    //Call Web Service
    CustomerService.GetCustomerDetails("SPIKEX",onWSRequestComplete);
}

function onWSRequestComplete(results)
{
    $get("lblContactName").innerHTML = results.ContactName;
    $get("lblGender").innerHTML = Model.Gender.toString(results.Gender);
    $get("txtStreet").value = results.Address.Street;
    $get("txtCity").value = results.Address.City;
    $get("txtState").value = results.Address.State;
    $get("hidCustomerID").value = results.CustomerID;
}