日期:2014-05-17 浏览次数:20411 次
<%@ WebHandler Language="C#" Class="_03_GetPhotoList" %>
using System;
using System.Web;
using System.Collections.Generic;
using System.Web.Script.Serialization;
public class _03_GetPhotoList : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
MyPhotos.BLL.Photos bll = new MyPhotos.BLL.Photos();
List<MyPhotos.Model.Photos> list = bll.GetModelList("");
//把对象转化成json格式的字符串
JavaScriptSerializer ser = new JavaScriptSerializer();
string s = ser.Serialize(list);
context.Response.Write(s);
}
public bool IsReusable {
get {
return false;
}
}
}
function Load(index) {
$.get("../Ajax/Handler_Message.ashx", { mod: "list", index: index }, function (data) {
var appendstr = [];
var json = eval("(" + data + ")");
var jsonstr = json.rows;
appendstr.push("<caption>留言管理中心</caption><tr><th>Id号</th><th>内容</th><th>时间");
appendstr.push("</th><th>状态</th><th>操作</th></tr>");
for (var i = 0, p = jsonstr.length; i < p; i++) {
appendstr.push("<tr>");
appendstr.push("<td>" + jsonstr[i].tid + "</td>");
appendstr.push("<td>" + jsonstr[i].note + "</td>");