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 ...
随机推荐
- TF Boys (TensorFlow Boys ) 养成记(二)
TensorFlow 的 How-Tos,讲解了这么几点: 1. 变量:创建,初始化,保存,加载,共享: 2. TensorFlow 的可视化学习,(r0.12版本后,加入了Embedding Vis ...
- 菜鸟日记-HTML-表格与表单
一.表格 <table></table> width:宽度.可以用像素或百分比表示. border:边框,常用值0 cellpadding:内容跟单元格边框的边距.常用值0 a ...
- javascript效果:手风琴、轮播图、图片滑动
最近都没有更,就来几个效果充实一下. 都没有进行美化这步. 手风琴: 纯css: <!DOCTYPE html> <html lang="en"> < ...
- Mars的自语重出江湖,祝大家端午节安康
上一篇博客似乎已是非常久远的回忆了,不再码字也已经很多年.<三国演义>里,刘备投靠曹操的那段时间里,2个兄弟问刘备未来,刘备说: 屈身守分,以待天时,不可与命争也. 这样一个时代,每个老百 ...
- 转:LAV Filter 源代码分析
1: 总体结构 LAV Filter 是一款视频分离和解码软件,他的分离器封装了FFMPEG中的libavformat,解码器则封装了FFMPEG中的libavcodec.它支持十分广泛的视音频格式. ...
- PoolMon 使用
PoolMon 显示 PoolMon 在命令窗口中显示有关池内存分配的数据列.使用箭头键.PAGE UP 和 PAGE DOWN 键在数据间滚动. 注意 若要查看全部 PoolMon 显示,则 ...
- java动态代理汇总
逛知乎,有篇关于fastjson如此快为什么国外还是喜欢用Jackson的问题,高票答案中有一点提到了fastjson有很多写死的地方,也不太适合像spring这种依赖AOP的框架使用,顺便提到了AS ...
- burp suite 使用教程详解(外文翻译转)
Burp Suite是Web应用程序测试的最佳工具之一,其多种功能可以帮我们执行各种任务.请求的拦截和修改,扫描web应用程序漏洞,以暴力破解登陆表单,执行会话令牌等多种的随机性检查.本文将做一个Bu ...
- js笔记--1
1.创建一个layer层 var GameLayer = cc.Layer.extend({ _time:null, _ship:null, _backSky:null, // 构造函数 ctor:f ...
- 代码生成器Sql Server 和 Mysql 数据库脚本
经常用到代码生成器,对于取数据脚本做个记录: #region SQL-SqlServer private string SqlTableList = @"SELECT so.name, Co ...