- 相關推薦
通過JQuery的Ajax調用一般處理程序
前言:
本示例大概功能是前臺通過JQuery的Ajax調用一般處理程序(Handler),獲取表格需要顯示的信息,然后轉換成json格式返回給前臺,前臺獲取到數(shù)據(jù)后循環(huán)構建表格的行,最好把行附加到表里。
目標:
a 熟悉簡單JQuery Ajax的使用
b 了解如何構造基本的Json格式的數(shù)據(jù)(構建Json也可以通過第三方的dll)
c 熟悉下handler的基本用法
1 簡單效果圖
2 前臺代碼
<%@ page="" language="C#" autoeventwireup="true" codefile="DialogAjax.aspx.cs" inherits="JQueryTest_DialogAjax">
3 Handler代碼
<%@ webhandler="" language="C#" class="TestHandler">using System;using System.Web;using System.Collections.Generic;using System.Text;using DataDAL;using DataEnity;public class TestHandler : IHttpHandler { HttpRequest Request; HttpResponse Response; public void ProcessRequest (HttpContext context) { //不讓瀏覽器緩存 context.Response.Buffer = true; context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); context.Response.AddHeader("pragma", "no-cache"); context.Response.AddHeader("cache-control", ""); context.Response.CacheControl = "no-cache"; context.Response.ContentType = "text/plain"; Request = context.Request; Response = context.Response; string method = Request["Method"].ToString(); System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(method); methodInfo.Invoke(this, null); } public void GetModuleInfo() { StringBuilder sb = new StringBuilder(); string jsonData = string.Empty; List
以上代碼超簡單吧,JQuery Ajax動態(tài)生成Table表格的內容就全部完成了,希望對大家有所幫助。
【通過JQuery的Ajax調用一般處理程序】相關文章:
原生ajax調用數(shù)據(jù)實例簡單講解07-19
旅游投訴的處理程序04-09
客戶投訴處理程序范本03-31
一般納稅人賬務處理流程02-07
關于OrCad原理圖設計中模塊化的調用07-12
愛爾蘭留學可以通過什么方式省錢01-09
公文寫作與處理10-24
企業(yè)能源審計的程序02-13
如何通過英語四六級考試09-04