ajax 解决方案(Newtonsoft.Json +jQuery +ashx)
来源:互联网 发布:js设置几秒后执行 编辑:程序博客网 时间:2024/05/17 13:39
http://www.cnblogs.com/ie421/archive/2008/08/19/1271601.html
1.json :Newtonsoft.Json http://files.cnblogs.com/ie421/Json20.zip
2.js:jQuery
3.服务器端:ashx
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string method = context.Request.Params["m"];
if(method=="test")
context.Response.Write(GetPersonListJosnString_2());
}
返回:{"ID":1,"FirstName":"肖","LastName":"永志"}
4.前台页面接收
$(document).ready(function(){
$.getJSON("/ashx/Ajax.ashx",{m:"test"},function(json){
$.each(json,function(i,item){
$("#test").append(item.ID+"."+item.FirstName+"<br/>");
})
})
});
$(document).ready(function(){
$.getJSON("/ashx/Ajax.ashx",{m:"test"},function(json){
var tb=$("#tb_name_list");
tb.find("tr").each(function(i){ //清空表,保留第一行
if (i>0) $(this).remove();
});
$.each(json,function(i,item){
var tr="<tr><td>"+item.ID+"</td><td>"+item.FirstName+"</td><td>"+item.LastName+"</td></tr>";
tb.append(tr);
})
})
});
« 上一篇:Serializing and deserializing JSON
» 下一篇:net中 类、方法作为参数传递的写法整理。(通过反射实现)(即传递类、传递方法的实现)
- ajax 解决方案(Newtonsoft.Json +jQuery +ashx)
- jquery ajax json ashx实用技巧
- jquery ajax,ashx,json用法小结
- jquery ajax,ashx,json用法小结
- Jquery+Ajax+Json+ashx生成表
- jquery ajax,ashx,json的用法总结
- ASP.NET MVC + jQuery + Newtonsoft.Json 快樂的AJAX
- ASP.NET MVC + jQuery + Newtonsoft.Json 快樂的AJAX
- ashx+jQuery,一个轻量级的asp.net ajax解决方案
- 无刷新分页控件(原创)(jQuery+json+ashx)(Ajax)
- jquery+ajax+ashx
- Jquery+ashx实现Ajax
- jquery+ajax+ashx
- Jquery+ashx实现Ajax
- Ashx+Jquery(Ajax)案例
- Jquery+ashx实现Ajax
- jquery+ajax+ashx。ashx的使用方法
- ASP.NET MVC + jQuery + Newtonsoft.Json 快樂的AJAX - lee576的专栏 - CSDNBlog
- js对象属性方法
- 地震中逃生十大法则
- 无题
- c++文件流基本用法(fstream, ifstream, ostream)
- 归去来兮辞 陶渊明
- ajax 解决方案(Newtonsoft.Json +jQuery +ashx)
- 关于编程的实例
- Linux下文件的操作(zt)
- windows下安装基于Apache的SVN服务器
- photoshop 光效果教程资源
- C#中Bitmap类实现对图像操作的一些方法
- 数据库连接
- AJAX 之使用ashx文件响应来自JQuery的JSON请求.
- 利用session监听器来控制用户的上下线和在线人数问题