﻿

var status = null;
var peopleDDL = null;

Sys.Application.add_load(initializeControls);

function initializeControls(e) {
    status = $get("status");
    peopleDDL = $get("Select1");
}

function RunCodeBehindMethod() {
    Sys.Net.WebServiceProxy.invoke(
    "AJAXPageMethods.aspx",
    "GetStaticString",
    false,
    null,
    RunCodeBehindMethodSucceeded,
    RunCodeBehindMethodFailed,
    3000
    );
}

function RunCodeBehindMethodSucceeded(results, context, methodName) {
    status.innerText = "Completed";
    for (i = 0; i < peopleDDL.length; i++) {
        peopleDDL.options[i] = null;
    }
    
    for (i = 0; i < results.length; i++) {
        peopleDDL.options[i] = new Option(results[i].FName + " " + results[i].LName, i.toString());
    }
}

function RunCodeBehindMethodFailed(results, context, methodName) {
    status.innerText = "FAILED";
}