JQuery 1.3.2联动获取部门
2018-06-17 19:52:17来源:未知 阅读 ()
| Sql | |
$(document).ready(function(){
$(".dept").bind("click", function () {
var self = this;
var open = $(self).attr("open");
if (open=="false") {
$(self).attr("open", "true");
}
$.ajax({
type: "post",
data: {
data: JSON.stringify( {Description:$(this).attr("desc")})
},
url: "GetDeptName.ashx",
success: function (data) {
if (data != null || data !== "") {
if (open=="false") {
$(self).children(".dept").remove();
return false;
}
var entitys = JSON.parse(data);
$.each(entitys.prod, function (index, element) {
var ul = $("<ul></ul>");
var li = "<li><span class='dept' open='false' desc='" + element.Description + "'>" + element.Name + "</span></li>";
ul.append(li);
$(self).after(ul);
});
}
}
});
});
});
c#代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
namespace Maticsoft.Web.Product
{
/// <summary>
/// GetDeptName 的摘要说明
/// </summary>
public class GetDeptName : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
JavaScriptSerializer jss = new JavaScriptSerializer();
string entity = context.Request["data"];
Model.Products model= jss.Deserialize<Model.Products>(entity);
List<Model.Products> prod = new BLL.Products().GetModelList(string.Format(" Catagory={0}",model.Description));
if (prod!=null&&prod.Count()>0)
{
context.Response.Write(jss.Serialize(new {prod= prod}));
return;
}
context.Response.Write(string.Empty);
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
下一篇:踩了一个炕:慎用默认参数
- Asp.net使用jQuery实现数据绑定与分页 2018-06-21
- Jquery Easy UI初步学习(三)数据增删改 2018-06-21
- 10分钟学会基于ASP.NET的 JQuery实例 (转) 2018-06-21
- 10 个让人惊讶的 jQuery 插件 2018-06-21
- jQuery制作鼠标经过显示图片大图,生成图片tips效果 2018-06-17
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
