Monday, May 12, 2014

How to call list by Josn in asp.net c#?

[WebMethod]
        public static AgencyLocation[] BindAgencyStateByserviceTest()
        {
            List<AgencyLocation> listAgencyLocationDef = new List<AgencyLocation>();          
            using (var objClient = ServiceAgentHelper.GetAgencyUserDetailContractClient())
            {
                listAgencyLocationDef = objClient.Channel.GetAgencyLocationByAgency(17, 1056706, "ALLS");
            }          
            return listAgencyLocationDef.ToArray();
        }






==============================

  <script src="../../Scripts/jquery-1.8.3.min.js" type="text/javascript" ></script>
    <script type="text/javascript">
        $(function () {         
            $.ajax({
                url: 'AgencyUserDetails.aspx/BindAgencyStateByserviceTest',
                type: 'POST',
                contentType: 'application/json; charset=utf-8',
                success: function (data) {
                    $.each(data.d, function (key, value) {
                      alert(value.Stateid);
                    });
                }
            });
        });
    </script>

No comments:

Post a Comment