- 相關(guān)推薦
通過JQuery的Ajax調(diào)用一般處理程序
前言:
本示例大概功能是前臺通過JQuery的Ajax調(diào)用一般處理程序(Handler),獲取表格需要顯示的信息,然后轉(zhuǎn)換成json格式返回給前臺,前臺獲取到數(shù)據(jù)后循環(huán)構(gòu)建表格的行,最好把行附加到表里。
目標(biāo):
a 熟悉簡單JQuery Ajax的使用
b 了解如何構(gòu)造基本的Json格式的數(shù)據(jù)(構(gòu)建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表格的內(nèi)容就全部完成了,希望對大家有所幫助。
【通過JQuery的Ajax調(diào)用一般處理程序】相關(guān)文章:
原生ajax調(diào)用數(shù)據(jù)實例簡單講解07-19
旅游投訴的處理程序04-09
客戶投訴處理程序范本03-31
一般納稅人賬務(wù)處理流程02-07
關(guān)于OrCad原理圖設(shè)計中模塊化的調(diào)用07-12
JAVA認(rèn)證基礎(chǔ)知識:基于反射機(jī)制的服務(wù)代理調(diào)用07-18
愛爾蘭留學(xué)可以通過什么方式省錢01-09
公文寫作與處理10-24
企業(yè)能源審計的程序02-13
如何通過英語四六級考試09-04