﻿function getCountiesByRegionID(RegionID, ctrl) {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "/Services/Counties.asmx/RetrieveCountystringByRegionID",
        data: "{'RegionID':'" + RegionID + "'}",
        dataType: "json",
        async: true,
        success: function(msg) {
            document.getElementById(ctrl).innerHTML = "";
            $("#" + ctrl).append(msg.d);
        }
    });
}

//function getCountiesByRegionID(RegionID, ctrl) {
//    $.ajax({
//        type: "POST",
//        contentType: "application/json; charset=utf-8",
//        url: "/Services/Counties.asmx/RetrieveCountiesByRegionID",
//        data: "{'RegionID':'" + RegionID + "'}",
//        dataType: "json",
//        async: true,
//        success: function(msg) {
//            $('#' + ctrl + ">option").remove();

//            if (msg.d.length > 0) {
//                $('#' + ctrl).append("<option value=''>All Counties</option>");
//                for (p in msg.d) {
//                    var County = msg.d[p]
//                    $('#' + ctrl).append("<option value='" + County.CountyID + "'>" + County.CountyName + "</option>");
//                }
//            }
//        }
//    });
//}
