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;
}
}
}
}
jquery getJSON的更多相关文章
- JSONP跨域原理和jQuery.getJSON用法
JSONP是一个非官方的协议,它允许在服务器端集成Script tags返回至客户端,通过javascript callback的形式实现跨域访问(这仅仅是JSONP简单的实现形式).本文主要介绍JS ...
- Jquery getJSON方法分析
准备工作 ·Customer类 public class Customer { public int Unid { get; set; } public string Customer ...
- 简单几招,解决jQuery.getJSON的缓存问题
今天做测试工作,发现了一个令我费解的问题,jquery的getJson方法在firefox上运行可以得到返回的结果,但是在ie8上测试,竟发现没有发送请求,故不能取到任何返回的结果,经历了一翻周折,找 ...
- jQuery.getJSON跨域访问的正确使用方式(史上最傻瓜式解释)
最近花了2天时间完整的看了一遍 jQuery 的API,其中 $.getJSON(url[, data][, callback]) 方法的跨域访问解释真心看的一头雾水,大家可以从这里感受一下: htt ...
- jQuery.getJSON()方法小记
今天看了下jQquery中的getJSON()方法,做点小结: 原型: jQuery.getJSON( url [, data ] [, success(data, textStatus, jqXHR ...
- [转]jQuery.getJSON的缓存问题的解决办法
本文转自:http://mfan.iteye.com/blog/974132 今天做测试工作,发现了一个令我费解的问题,jquery的getJson方法在firefox上运行可以得到返回的结果,但是在 ...
- jQuery.getJSON(url, [data], [callback])
jQuery.getJSON(url, [data], [callback]) 概述 通过 HTTP GET 请求载入 JSON 数据. 在 jQuery 1.2 中,您可以通过使用JSONP形式的回 ...
- jQuery getJSON() 能给外部变量赋值
//getJSON 内部已经赋值给count,alert出数据来看看是不是0 var count=0; $.getJSON(sUrl,{"ran": new Date().getD ...
- jquery $.getJSON()跨域请求
以前总是没搞明白是怎么回事,现在是迫不得已,就仔细看了看说明文档,终于测试成功了,记下 1,同一域名下和其他的请求可以是一样的 js: 代码如下: var url="http://loc ...
- JQuery.getJSON 没反应
Jquery是一个优秀的Javascrīpt框架,轻量级的js库,它兼容CSS3.jQuery使用户能更方便地处理HTML documents.events.实现动画效果,并且方便地为网站提供AJAX ...
随机推荐
- paip.广告过滤系统 php 实现
paip.广告过滤系统 php 实现 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net/at ...
- JSTL核心标签库使用
JSTL是什么? java standard taglib(java标准标签库). 标签是什么? sun公司制订的一种技术规范,用来将jsp页面中的java代码使用类似于html当中的标记来替换 的一 ...
- bzoj 1207: [HNOI2004]打鼹鼠
1207: [HNOI2004]打鼹鼠 Time Limit: 10 Sec Memory Limit: 162 MB Description 鼹鼠是一种很喜欢挖洞的动物,但每过一定的时间,它还是喜 ...
- Android BitmapShader 实战 实现圆形、圆角图片
转载自:http://blog.csdn.net/lmj623565791/article/details/41967509 1.概述 记得初学那会写过一篇博客Android 完美实现图片圆角和圆形( ...
- 永久删除 tadb.exe
系统安装qq手机管家等手机管理软件之后,在开机时会自动运行tadb.exe, 这个垃圾进程会让开发android程序时默认的 adb.exe启动不了,这样就没法用手机调试. 这并不是说tadb.exe ...
- drupal7安装中文错误
安装中文错误 星期四, 07/04/2013 - 15:06 — tao_3000 更多0 An AJAX HTTP error occurred. HTTP Result Code: 200 Deb ...
- Scala 基础入门【翻译】
原文地址 本文只是带你进入 Scala 的世界,包括安装.不可变量 val.可变量 var.定义类.集合(包括列表(list).集(set).映射(map))以及集合遍历和集合库(能达到并行/并发效果 ...
- ldr和adr在使用标号表达式作为操作数的区别
ARM汇编有ldr指令以及ldr.adr伪指令,他门都可以将标号表达式作为操作数,下面通过分析一段代码以及对应的反汇编结果来说明它们的区别. ldr r0, _start adr r0 ...
- SQLServer公历转农历函数(1900年-2049年)
ALTER FUNCTION [dbo].[f_SysGetLunar]( @solarDay DATETIME) RETURNS varchar(20 ...
- 将复杂form表单序列化serialize-object.js
<form class="form-horizontal" role="form" id="myform" action=" ...