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

jquery getJSON的更多相关文章

  1. JSONP跨域原理和jQuery.getJSON用法

    JSONP是一个非官方的协议,它允许在服务器端集成Script tags返回至客户端,通过javascript callback的形式实现跨域访问(这仅仅是JSONP简单的实现形式).本文主要介绍JS ...

  2. Jquery getJSON方法分析

    准备工作 ·Customer类 public class Customer {     public int Unid { get; set; }     public string Customer ...

  3. 简单几招,解决jQuery.getJSON的缓存问题

    今天做测试工作,发现了一个令我费解的问题,jquery的getJson方法在firefox上运行可以得到返回的结果,但是在ie8上测试,竟发现没有发送请求,故不能取到任何返回的结果,经历了一翻周折,找 ...

  4. jQuery.getJSON跨域访问的正确使用方式(史上最傻瓜式解释)

    最近花了2天时间完整的看了一遍 jQuery 的API,其中 $.getJSON(url[, data][, callback]) 方法的跨域访问解释真心看的一头雾水,大家可以从这里感受一下: htt ...

  5. jQuery.getJSON()方法小记

    今天看了下jQquery中的getJSON()方法,做点小结: 原型: jQuery.getJSON( url [, data ] [, success(data, textStatus, jqXHR ...

  6. [转]jQuery.getJSON的缓存问题的解决办法

    本文转自:http://mfan.iteye.com/blog/974132 今天做测试工作,发现了一个令我费解的问题,jquery的getJson方法在firefox上运行可以得到返回的结果,但是在 ...

  7. jQuery.getJSON(url, [data], [callback])

    jQuery.getJSON(url, [data], [callback]) 概述 通过 HTTP GET 请求载入 JSON 数据. 在 jQuery 1.2 中,您可以通过使用JSONP形式的回 ...

  8. jQuery getJSON() 能给外部变量赋值

    //getJSON 内部已经赋值给count,alert出数据来看看是不是0 var count=0; $.getJSON(sUrl,{"ran": new Date().getD ...

  9. jquery $.getJSON()跨域请求

    以前总是没搞明白是怎么回事,现在是迫不得已,就仔细看了看说明文档,终于测试成功了,记下   1,同一域名下和其他的请求可以是一样的 js: 代码如下: var url="http://loc ...

  10. JQuery.getJSON 没反应

    Jquery是一个优秀的Javascrīpt框架,轻量级的js库,它兼容CSS3.jQuery使用户能更方便地处理HTML documents.events.实现动画效果,并且方便地为网站提供AJAX ...

随机推荐

  1. Linux中ctrl-c, ctrl-z, ctrl-d 区别

    在Linux中: ctrl-c: ( kill foreground process )   发送 SIGINT 信号给前台进程组中的所有进程,强制终止程序的执行: ctrl-z: ( suspend ...

  2. iOS开发-xCode代码格式化xAlign

    xCode默认是可以进行代码格式化的,能满足基础开发需求,如果想要个性一些代码对齐方式宏对齐,等号对齐,属性对齐,xAlign就提供了以上三种功能,参考文中效果~ 基础效果 等号对齐: 属性对齐: 宏 ...

  3. JAVA学习Swing绝对局部简单学习

    package com.swing; import java.awt.Container; import javax.swing.JButton; import javax.swing.JFrame; ...

  4. js 导出Excel

    最近从Silverlight这边转到javascript过来,现在要导出一个导出excel的功能.上级领导指示当页显示多少数据,就导出多少数据,没有必要从后台在去数据.以前也没有接触过这方面的,在网上 ...

  5. VC基于消息的异步套接字

    用WSAStartup,需要在StdAfx.h头文件中需要声明 #include    #pragma   comment(lib,"WS2_32.lib") 用AfxSocket ...

  6. 在VC项目中附加包含目录

    1.VC2010项目中附加包含目录 上图项目中附加了两个文件夹,一个是上级目录下的CommonClass,一个是下级目录下的invengo. 使用这两个目录下的类时直接在include后面写头文件名即 ...

  7. LPC4370 ACDHS speed and DMA

    LPC4370 ACDHS speed AHB clock BASE_M4_CLK CLK_M4_ADCHS up to 204 MHz. For register interface. ADCHS ...

  8. EWM ODO清理功能

    ERP OBD下传到EWM会自动产生拣货任务(通常做法),但如果EWM因库存不足或其它原因无法拣货时一般要差异确认,对ODO行项目进行0确认.但问题是零确认后EWM标准流程是无法回传ERP的. ERP ...

  9. BootStrap安装

    1. 安装Node.js    http://nodejs.org/download/ 2. 加速NPM安装    npm install -g cnpm --registry=http://r.cn ...

  10. linux的库文件

    静态库和动态库 在windows中静态库是以 .lib 为后缀的文件,共享库是以.dll 为后缀的文件.在linux中静态库是以 .a 为后缀的文件,共享库是以 .so为后缀的文件. 以linux下的 ...