• 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;
                }
            }
        }
    }

  • 相关阅读:
    散点图增加趋势线
    asp.net自动刷新获取数据
    jQuery在asp.net中实现图片自动滚动
    tornado 学习笔记一:模板
    node.js 学习笔记二:创建属于自己的模块
    mysql 5.6 innodb memcache 操作学习一
    unicode,str
    node.js 学习笔记四:读取文件
    gevent 学习笔记一
    while 循环居然可以用else
  • 原文地址:https://www.cnblogs.com/lingxzg/p/3543107.html
Copyright © 2020-2023  润新知