• jquery getJSON


            function onNodeClick(data) {
                //只能选择体检分组
                if (data.GroupType == 1) {
                    $("#<%=hidOrgId.ClientID%>").val(data.Id);
                    $("#<%=hidOrgName.ClientID%>").val(data.Text);
                    $("#<%=txtGroup.ClientID%>").val(data.Text);
                    $("#divCheckUpTree").dialog("close");


                    $("#<%=ddlDrs.ClientID %>").html("");
                    var url = "AjaxHelper.ashx?validatorType=GetDoctorByOrgId&orgID=" + data.Id;
                    $.getJSON(url, function (json) {
                        //debugger
                        if (json != null) {
                            $.each(json, function (i) {
                                $("#<%=ddlDrs.ClientID %>").append($("<option></option>").val(json[i].DrID).html(json[i].DrName))
                            });
                        }

                    });

                    $("#<%=ddlDrs.ClientID %>").append($("<option selected='true'></option>").val("-1").html("请选择"))
    //                $("<option></option>").val("").html("").appendTo("#<%=ddlDrs.ClientID %>");

                }
            }

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Xys.Remp.Enterprise.Services.Interface;
    using Xys.Remp.Enterprise.Entity;
    using Xys.Remp.Core;
    using Xys.Remp.Security;
    using System.Web.SessionState;
    using Xys.Remp.Enterprise.Common;
    using RempWeb = Xys.Remp.Web;
    using System.Text;
    using Xys.Remp.Serialize.Json;
    namespace Xys.Stroke.Web.Archives
    {
        public class AjaxHelper : IHttpHandler, IRequiresSessionState
        {

            public void ProcessRequest(HttpContext context)
            {
                string validatorType = RempWeb.ComUtils.GetQueryStringToString("validatorType");
                if (validatorType != string.Empty)
                {
                    if (validatorType == "GetDoctorByOrgId")
                    {
                        int? orgID = RempWeb.ComUtils.GetQueryStringToInt("orgID");
                        if (orgID.HasValue)
                        {
                            OrganizationInfo orgInfo = ServiceFactory.GetService<IOpenOrganizationService>().GetFirstParentOrgByGroupId((int)orgID);
                            if (orgInfo != null)
                            {
                                List<DoctorInfo> doctorList = ServiceFactory.GetService<IOpenDoctorService>().GetDoctorListAndUnderByOrgId((int)orgInfo.OrgID, true);
                                if (doctorList.Count > 0)
                                {
                                    //StringBuilder sb = new StringBuilder();
                                    //sb.Append("[");
                                    //foreach (DoctorInfo doctor in doctorList)
                                    //{
                                    //    sb.Append("{"ID":"" + doctor.ID + "","Name":"" + doctor.DrName + ""},");
                                    //}

                                    //sb.Remove(sb.Length - 1, 1);
                                    //sb.Append("]");
                                   
                                    ResponseValidatorValue(context,doctorList.JsonSerialize());
                                }
                                else
                                {
                                    ResponseValidatorValue(context, "");
                                }
                            }
                        }
                    }
                    //else if (validatorType == "")
                    //{
                    //}

                }
            }

            public void ResponseValidatorValue(HttpContext context, string validatorValue)
            {
                context.Response.Expires = 0;
                context.Response.Buffer = true;
                context.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
                context.Response.AddHeader("pragma", "no-cache");
                context.Response.CacheControl = "no-cache";
                context.Response.ClearContent();
                context.Response.ContentType = ("text/plain");
                context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                context.Response.Write(validatorValue);
                context.Response.Flush();
                context.Response.End();
            }

            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
    }

  • 相关阅读:
    链表基础及常见面试题
    浅谈一个网页打开的全过程(涉及DNS、CDN、Nginx负载均衡等)
    PHP函数高级(二)
    sql注入笔记
    PHPStorm2017去掉参数提示 parameter name hints
    CDN与智能DNS原理和应用
    用户黏性与垂直社区,互联网营销 狼人:
    我在赶集网的两个月(完整版),互联网营销 狼人:
    微博变种与RSS变种,互联网营销 狼人:
    从 Reddit 学到的经验,互联网营销 狼人:
  • 原文地址:https://www.cnblogs.com/lingxzg/p/3543107.html
Copyright © 2020-2023  润新知